mysqlの基礎
update
update people set birth_date = '1987-11-27' where id = 10096; # updateする テーブル名 set 変更内容 where 変更箇所 # peopleテーブルのidが10096のbirth_dateを'1987-11-27'にアップデートする
delete
delete from テーブル名 where 該当箇所;
insert
insert into people (id, birth_date, created_at, updated_at) values ('10097', '1987-03-03', NOW(), NOW()); # created_atとupdated_atがないと更新できない仕様に作られているテーブルにインサートする場合 NOW()は現在の時刻をタイムスタンプで記録してくれる
select inner_memoに'テスト'という文字列を含む行のidを取得
select id from people where memo like '%テスト%';
%テスト → で終わる
テスト_ → テストではじまりその後ろに任意の1文字がある
show databases;
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | 家計簿 | | blog_app | | mysql | | sys | | testdb | +--------------------+
desc テーブル名
カラム一覧を取得