알아두기/SQL
sql 기초명령어
값을변경
2022. 2. 20. 12:14
create table 테이블명 (
칼럼명 number(3) not null primary key,
칼럼명 varchar2(40)
);
drop table 테이블명;
select * from 테이블명;
create table 테이블명 (
칼럼명 number(3) not null,
칼럼명 varchar2(40)
primary key (칼럼명, 칼럼명) --primary key 2개 이상
);
create sequence 시퀀스명;
create sequence 시퀀스명
increment by 1
start with 1
maxvalue 1
;
drop sequence 시퀀스명;
select * from 시퀀스명;
insert into 테이블명 values( ?, ? );
update 테이블명 set 칼럼명 = 바꿀data;
update 테이블명 set 칼럼명 = 바꿀data, 칼럼명 = 바꿀data;
함수있는 칼럼과 일반 칼럼과 같이 쓸 수 없음. (group by)
select sum(sal), deptno,job from emp GROUP BY deptno, job;
delete from 테이블명 where 칼럼명 = 조건;
commit;
INSERT INTO ~
UPDATE ~ SET
DELETE FROM ~
sqlplus
id / password