Skip to content

Instantly share code, notes, and snippets.

@nayed
Last active August 30, 2016 10:33
Show Gist options
  • Save nayed/5056fc0a0b3718ca8e5d6690d15afc1e to your computer and use it in GitHub Desktop.
Save nayed/5056fc0a0b3718ca8e5d6690d15afc1e to your computer and use it in GitHub Desktop.

Random update a column with a list of value:

UPDATE TABLE t
    SET column = elt(floor(rand()*3) + 1, 'value1', 'value2', 'value3');

Update join:

UPDATE TABLEA a 
   JOIN TABLEB b ON a.join_colA = b.join_colB  
   SET a.columnToUpdate = [something]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment