1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MySQLよく使うコマンドメモ(自分用備忘録)

Last updated at Posted at 2019-09-02

はじめに

MySQLをいじっててよく使うコマンドをメモしました。

データの追加

INSERT INTO <テーブル名> VALUES (<値1>, <値2>, <値3>, …);

列の追加

ALTER TABLE <テーブル名> ADD <列名> <データ型>

列の削除

ALTER TABLE <テーブル名> DROP COLUMN <列名>

データの変更

UPDATE <テーブル名> SET <列名> = <更新後の値> WHERE <条件>

データの削除

DELETE FROM <テーブル名> WHERE <条件>

データの選択(ソートして上位n個取得)

SELECT <取得する列名> FROM <テーブル名> ORDER BY <ソートに使う列名> DESC LIMIT <<取得する個数n>

言い訳

あくまで自分用のメモですので…。また追加します。

2019/10/01更新

1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?