Table 생성
create table 테이블_명 (
column명 타입,
.
.
.
);
ex )
create table S (
snum int,
sname char(20) );
Table Data 삽입
insert into 테이블_명 values (col에 해당하는 값);
ex)
insert into s values (1,'NNN');
or
insert into s (snum, sname) values (1, 'NNN');
Table 선택
select col명 from 테이블명 where 조건;
ex)
select * from s;
or
select sname from s where snum=1;
or
select snum sname from s;
Table에 Column 추가
alter table 테이블명 add column ( 추가할 col명 );
ex)
alter table s add column ( sdata);
Table에서 1 Row 지우기
delete from 테이블명 where 조건;
ex )
delete from s where snum=1;
Table 정보보기
desc 테이블명;
ex)
desc s;
Table 기존 내용 변경
update 테이블명 set column명=값 where 조건;
ex)
update s set sname='JJJ' where snum=1;
Table 삭제
drop table 테이블명;
ex)
drop table s;
Table 내용만 삭제
truncate table 테이블명;
ex)
truncate table s;
'!? > SQL' 카테고리의 다른 글
altibase를 깔았다. (0) | 2013.09.19 |
---|