본문 바로가기
Database/SQL

[SQL] 공부 Reiview

by 나비와꽃기린 2015. 1. 25.

<<<<<<<<<<<<<<<<<<<   >>>>>>>>>>>>>>>>>>>

<<<<<<<<<<<<<<   SQL Review  >>>>>>>>>>>>>>

<<<<<<<<<<<<<<<<<<<   >>>>>>>>>>>>>>>>>>>

 

1) DDL(Data Definition Language)연습

 

==> table만들기

create table product(

 p_name varchar2(20),

 p_price number

);

 

==> talbe 의 구조 확인하기

desc product;

 

==> table 지우기

drop table product;

 

 

 

2)DML(Data Manipulation Language)연습

 

==> talbe 만들고 table에 data 삽입

create table product(

 p_name varchar2(20),

 p_price number

);

 

==>table의 구조 확인

desc product;

 

==>table에 data 삽입

insert into product values('jdbc book',20000);

insert into product values('프린터',100000);

 

==>table에 data 조회하기

select * from product;

 

 

 

2)TCL(Transaction Control Language)연습

 

==>작업 저장하기

commit;

 

==> data를 삽입,수정,삭제,rollback확인

insert into product values('servlet book',5000);

 

select * from product;

 

update product set p_price=10000 where p_name='servlet book';

 

select * from product;

 

 

==> 작업 취소하기

rollback;

 

select * from product;

 

insert into product values('servlet book',5000);

 

select * from product where p_name='servlet book';

 

update product set p_price=10000 where p_name='servlet book';

 

select * from product where p_price=10000;

 

==>작업 저장하기

commit;

 

 

==>data를 delete하기, commit

delete product where p_name='servlet book';

 

select * from product;

 

commit;

'Database > SQL' 카테고리의 다른 글

[SQL] 공부 Review  (0) 2015.01.30
[SQL] 공부 Review  (0) 2015.01.25
[SQL] 공부 Review  (2) 2015.01.25
[SQL] 공부 Reiview  (0) 2015.01.25

댓글0