Oracle DB 문제풀이

강정우·2022년 7월 11일
0

DB

목록 보기
24/30
post-thumbnail

문제 1 table을 만드시오.

  • 코드
create table dept
(DEPTNO number(2), DNAME varchar2(14) not null, LOC varchar2(13) not null,
constraint dept_DEPTNO_pk primary key(DEPTNO));

create table emp
(EMPNO number(4), ENAME varchar2(10) not null, GENDER char(10) not null, JOB varchar2(9) not null,
MGR number(4), HIREDATE date not null, SAL number(7,2) not null, COMM number(7,2), DEPTNO number(2),
constraint emp_EMPNO_pk primary key(EMPNO),
constraint emp_GENDER_ck check(GENDER in ('MAN', 'WOMAN')),
constraint emp_DEPTNO_fk foreign key (DEPTNO) references dept(DEPTNO));

문제 2 table을 작성하시오.

insert into dept
values (10, 'Adminstration',1700);

insert into dept
values (20, 'Marketing',1800);

insert into dept
values (30, 'Purchasing',1700);

insert into dept
values (40, 'Human',2400);

insert into dept
values (50, 'Shipping',1500);




insert into emp
values (100, 'King', 'MAN', 'AD_PRES', null, '87/01/17', 24000, null, 10);

insert into emp
values (101, 'Kochar', 'MAN', 'AD_VP', 100, '89/09/21', 17000, null, 50);

insert into emp
values (102, 'DE Haen', 'WOMAN', 'AD_VP', 100, '93/01/13', 17000, null, 50);

insert into emp
values (103, 'Hunold', 'MAN', 'IT_PROG', 102, '90/07/03', 9000, null, 40);

insert into emp
values (104, 'Ernst', 'WOMAN', 'IT_PROG', 103, '97/07/25', 4800, null, 40);

commit;

부록

  • insert를 한 큐에 넣는 방법.
  • 가장 위험 한 첫 줄...
profile
智(지)! 德(덕)! 體(체)!

0개의 댓글