Nützliche Mysql Snippets
Dinge die man sich nicht merken kann, sollte man sich aufschreiben!
Bitmask Select MySQL
SELECT * FROM menus WHERE (owner & 2) = 2 (with 2 being the bitmask value and owner the field with your bitmask values)
Varchar-Datum in richtiges DateTime wandeln
SELECT zeit,STR_TO_DATE(zeit, '%d\. %M %Y') FROM guestbook WHERE 1
Auto-increment anpassen / adjust auto-increment value
ALTER TABLE tbl AUTO_INCREMENT = 100;
Spalte innerhalb einer Tabelle verschieben, Rearrange column order in table:
ALTER TABLE my_table MODIFY COLUMN products_id int AFTER categories_id
Table zu utf-8 wandeln, Convert table to utf-8:
ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
Tabellen-Kommentare hinzufügen, Inserting database table comments:
ALTER TABLE tablename COMMENT = 'new updated comment';

