This is an old revision of the document!


MySQL Snippets

Character Sets

  • Change to UTF-8
    • ALTER TABLE XX CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci
  • Duplicate rows
    • CREATE TEMPORARY TABLE tmp SELECT * FROM table WHERE column = X;
    • UPDATE tmp SET column=YY, autoincr_column=NULL;
    • INSERT INTO table SELECT * FROM tmp;