This is an old revision of the document!


MySQL Snippets

Character Sets

  • Change to UTF-8 (use utf8mb4 to include latest emoticons)
    • ALTER TABLE xx CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

Table manipulation

  • 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;