0. DML 전 유의사항
safe update 설정 해제 필수!


1. INSERT
스키마 체크
select * from bonus;
desc bonus;


insert into bonus(ename, job, sal, comm) values('홍길동', '프로그래머', 600, 100);
insert into bonus(ename, job, sal, comm) values('임꺽정', '변호사', 1000, 200);
- affected 체크

- select * from bonus로 확인해보기

2. UPDATE
-- 2. UPDATE
update bonus
set sal = 2000, comm = 500
where job = '프로그래머';
- ‘1 row(s) affected Rows matched: 1 Changed: 1 Warnings: 0’ 체크

- select * from bonus로 확인해보기

-- job이 변호사인 친구의 이름을 임하룡으로 변경하시오.
update bonus
set ename = '임하룡'
where job = '변호사';
- ‘1 row(s) affected Rows matched: 1 Changed: 1 Warnings: 0’ 체크

- select * from bonus로 확인해보기

3. DELETE
delete from bonus where job = '프로그래머';
- affected 체크

- select * from bonus로 확인해보기

전체 코드
-- DML (데이터 조작어)
-- 1. INSERT
select * from bonus;
desc bonus;
insert into bonus(ename, job, sal, comm) values('홍길동', '프로그래머', 600, 100);
insert into bonus(ename, job, sal, comm) values('임꺽정', '변호사', 1000, 200);
-- 2. UPDATE
update bonus
set sal = 2000, comm = 500
where job = '프로그래머';
-- job이 변호사인 친구의 이름을 임하룡으로 변경하시오.
update bonus
set ename = '임하룡'
where job = '변호사';
-- 3. DELETE
delete from bonus where job = '프로그래머';
Share article