desc テーブル名 | テーブルのフィールドを表示 |
select * from テーブル名; | 全てのフィールドを表示する |
select フィールド名 from テーブル名; | 指定したフィールドを表示する |
select * from テーブル名 where フィールド名='文字列'; | 指定したレコードを表示する |
select count(*) from テーブル名; | レコードの総数を表示する |
select max(フィールド名) from テーブル名; | 指定したフィールドの最大値を表示する |
update テーブル名 set フィールド名=値 whereフィールド名=値; | テーブルを更新する |
delete テーブル名; | テーブルのデータを全て削除する |
delete テーブル名 where フィールド名='文字列'; | 指定したレコードを削除する |
insert into テーブル名 ('値','値',・・・); | レコードを追加する |
alter table テーブル名 add(フィールド名 型,フィールド名 型・・・); | カラムを追加する |
alter table テーブル名 modify(フィールド名 型,フィールド名 型・・・); | カラムの定義を変更する |
commit; | 変更した処理を有効にする |
rollback; | 変更した内容を元に戻す |