UPDATE & DELETE : 修改刪除資料
先將workbench預設的更新模式關閉
SET SQL_SAFE_UPDATES=0;
原來的student TABLE
UPDATE `student`
SET `major` = '英語文學'
WHERE `major` = '英語';
SELECT * FROM `student`;
UPDATE `student`
SET `major` = '生物'
WHERE `student_id` = '3';
SELECT * FROM `student`;
UPDATE `student`
SET `major` = '生化'
WHERE `major` = '生物' OR `major` = '化學';
SELECT * FROM `student`
UPDATE `student`
SET `name` = '小灰', `major` = '生化'
WHERE `student_id` = 1;
SELECT * FROM `student`
UPDATE `student`
SET `major` = '物理';
SELECT * FROM `student`
DELETE FROM `student`
WHERE `student_id` = 4;
SELECT * FROM `student`;
DELETE FROM `student`
WHERE `name` = '小灰' AND `major` = '物理';
SELECT * FROM `student`;
> 大於 < 小於 >= 大於等於 <=小於等於 =等於 <>不等於
DELETE FROM `student`
WHERE `score` < 60;
SELECT * FROM `student`;
DELETE FROM `student` ;
SELECT * FROM `student`;