DELETE文
DELETE
はcrud
のDelete
にあたるもの
基本
使用方法
DELETE FROM table_name;
WHERE
で条件指定できる
table:user
name | age | gender | address |
---|---|---|---|
john | 23 | male | Tokyo |
james | 15 | male | Osaka |
robert | 20 | male | Tokyo |
michael | 32 | male | Fukuoka |
william | 18 | male | Tokyo |
address
がTokyo
の人を削除
DELETE FROM user WHERE address = 'Tokyo';
age
が20未満の人を削除
DELETE FROM user WHERE age < 20;
name
がjから始まる人を削除
DELETE FROM user WHERE name LIKE 'j%';