CREATE TABLE JOBS
(
JOB_ID VARCHAR(10),
JOB_TITLE VARCHAR(35) CONSTRAINT JOB_TITLE_NN NOT NULL,
MIN_SALARY NUMERIC(6),
MAX_SALARY NUMERIC(6)
);
CREATE TABLE DEPARTMENTS
(
DEPARTMENT_ID NUMERIC(4),
DEPARTMENT_NAME VARCHAR(30) CONSTRAINT DEPT_NAME_NN NOT NULL,
MANAGER_ID NUMERIC(6),
LOCATION_ID NUMERIC(4)
);
CREATE TABLE EMPLOYEES
(
EMPLOYEE_ID NUMERIC(6),
FIRST_NAME VARCHAR(20),
LAST_NAME VARCHAR(25) CONSTRAINT EMP_LAST_NAME_NN NOT NULL,
EMAIL VARCHAR(25) CONSTRAINT EMP_EMAIL_NN NOT NULL,
PHONE_NUMBER VARCHAR(20),
HIRE_DATE TIMESTAMP CONSTRAINT EMP_HIRE_DATE_NN NOT NULL,
JOB_ID VARCHAR(10) CONSTRAINT EMP_JOB_NN NOT NULL,
SALARY NUMERIC(8,2),
COMMISSION_PCT NUMERIC(2,2),
MANAGER_ID NUMERIC(6),
DEPARTMENT_ID NUMERIC(4)
);
CREATE TABLE REGIONS
(
REGION_ID NUMERIC CONSTRAINT REGION_ID_NN NOT NULL,
REGION_NAME VARCHAR(25)
);
CREATE TABLE COUNTRIES
(
COUNTRY_ID CHAR(2) CONSTRAINT COUNTRY_ID_NN NOT NULL,
COUNTRY_NAME VARCHAR(40),
REGION_ID NUMERIC,
CONSTRAINT COUNTRY_C_ID_PK PRIMARY KEY(COUNTRY_ID)
);
CREATE TABLE LOCATIONS
(
LOCATION_ID NUMERIC(4),
STREET_ADDRESS VARCHAR(40),
POSTAL_CODE VARCHAR(12),
CITY VARCHAR(30) CONSTRAINT LOC_CITY_NN NOT NULL,
STATE_PROVINCE VARCHAR(25),
COUNTRY_ID CHAR(2)
);
CREATE TABLE JOB_HISTORY
(
EMPLOYEE_ID NUMERIC(6) CONSTRAINT JHIST_EMPLOYEE_NN NOT NULL,
START_DATE TIMESTAMP CONSTRAINT JHIST_START_DATE_NN NOT NULL,
END_DATE TIMESTAMP CONSTRAINT JHIST_END_DATE_NN NOT NULL,
JOB_ID VARCHAR(10) CONSTRAINT JHIST_JOB_NN NOT NULL,
DEPARTMENT_ID NUMERIC(4)
);
안녕하세요.
위의 테이블들로 시간이 오래걸리는 select 문 하나작서해 주실수 있는 분 계신가요..
제 능력으론 그냥 순식간에 결과가 나와 버리네요..
부탁드립니다.
감사합니다. |