Skip to content

Instantly share code, notes, and snippets.

@davidbehan
Created May 11, 2013 16:54
Show Gist options
  • Save davidbehan/5560590 to your computer and use it in GitHub Desktop.
Save davidbehan/5560590 to your computer and use it in GitHub Desktop.
Some SQL commands I use every now and then, in current state or modified versions
# SQL Like Usage
# - - - - - - - - - - - - - - - - - - - - - - - - - -
SELECT * FROM asdf WHERE asdf LIKE 'asdf%';
UPDATE asdf
SET asdf = ""
WHERE asdf LIKE '/images/uploads/asdf%';
UPDATE asdf
SET asdf = replace(asdf,'/images/uploads/logos/cropped/ready/','/images/uploads/logos/')
WHERE asdf LIKE '/images/uploads/logos/cropped/ready/%';
# import SQL file into table
# - - - - - - - - - - - - - - - - - - - - - - - - - -
LOAD DATA
INFILE '~/Desktop/csv.txt'
INTO TABLE asdf
COLUMNS TERMINATED BY ','
LINES TERMINATED BY '\n';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment