LoginSignup
0
0

More than 3 years have passed since last update.

自分用MySQLチートシート

Posted at

TL;DR

MySQL覚えられなくて同じことを何度もググってしまうので自分用にチートシートを作成しておく。プレーンのmysqlコマンドではなくmycliを使うと補完が利くので便利。

チートシート

CREATE

AUTO_INCREMENT, NOT NULLの付与

CREATE TABLE table_name (col_name1 type NOT NULL AUTO_INCREMENT)

あとからAUTO_INCREMENTを付与する

ALTER TABLE table_name CHANGE col_name type AUTO_INCREMENT

UPDATE

データの更新

UPDATE table_name SET col_name1=value1 [, col_name2=value2, ...] [WHERE condition]

DELETE

データの削除

DELETE FROM table_name [WHERE condition]

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0