๋ฐ์ํ
1. UPDATE
update ํ ์ด๋ธ๋ช
set ์ปฌ๋ผ๋ช = ๊ฐ
[where ์กฐ๊ฑด๋ฌธ];
---------------------------------
update ํ ์ด๋ธ๋ช
set ์ปฌ๋ผ๋ช 1 = ๊ฐ1, ์ปฌ๋ผ๋ช 1 = ๊ฐ2, ...
[where ์กฐ๊ฑด๋ฌธ];
โ. products ํ ์ด๋ธ์ ๋ชจ๋ ์ํ ๊ฐ๊ฒฉ์ 50 ์ธ์
update products
set price = price + 50;
//where ์ ์์ด update ๊ตฌ๋ฌธ ์์ฑ ์ ๋ชจ๋ ํ์ด ์์
โ. products ํ ์ด๋ธ์ TV ์ ํ ๊ฐ๊ฒฉ์ 40 ์ธ์
update products
set price = price + 40
where pro_name = 'TV';
2. DELETE
delete from ํ ์ด๋ธ๋ช
[where ์กฐ๊ฑด๋ฌธ];
โ. stu20 ํ ์ด๋ธ์์ ๋์ด๊ฐ 25์ดํ์ธ ํ์ ์ญ์
delete from stu20
where age <= 25;
3. COMMIT : DML ์์ ํ ์ ์ฅํ๋ ๋ช ๋ น์ด
4. ROLLBACK : DML ์์ ํ ์ทจ์ํ๋ ๋ช ๋ น์ด
๋ฐ์ํ
'STUDY > DATABASE' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
MySQL - ERD ๋ง๋ค๊ธฐ (0) | 2022.04.12 |
---|---|
MySQL ๋ฌธ๋ฒ (0) | 2022.04.12 |
MySQL ๋ฐ์ดํฐ ์กฐํ(SELECT) (0) | 2022.04.11 |
My SQL ํ ์ด๋ธ์ ๋ฐ์ดํฐ ์กฐ์(auto_incremenet, insert) (0) | 2022.04.11 |
MySQL DB์์ฑ ๋ฐ ํ ์ด๋ธ ์์ฑ (0) | 2022.04.11 |