Oracle Database 10g SQL Fundamentals I - Practice 9
개발 및 관리/Oracle 9i, 10g, 11g, 12c, 19c 2012. 11. 13. 16:54반응형
1.
CREATE TABLE DEPT_TEST(
ID NUMBER(7),
NAME VARCHAR2(25),
CONSTRAINT DEPT_TEST_ID_PK PRIMARY KEY (ID)
)
;
2.
INSER INTO DEPT_TEST
SELECT DEPARTMENT_ID, DEPARTMENT_NAME
FROM DEPARTMENTS
;
3.
CREATE TABLE EMP_TEST(
ID NUMBER(7),
LAST_NAME VARCHAR2(25),
FIRST_NAME VARCHAR2(25),
DEPT_ID NUMBER(7),
CONSTRAINT EMP_DEPT_TEST_FK FOREIGN KEY(DEPT_ID) REFERENCES DEPT_TEST(ID)
)
;
4.
CREATE TABLE EMP_TEST2
AS SELECT EMPLOYEE_ID ID, FIRST_NAME, LAST_NAME, SALARY, DEPARTMENT_ID DEPT_ID
FROM EMPLOYEES WHERE 1 = 2;
5.
DROP TABLE EMP_TEST2;
반응형
'개발 및 관리 > Oracle 9i, 10g, 11g, 12c, 19c' 카테고리의 다른 글
Oracle Database 10g SQL Fundamentals I - Practice 8 (0) | 2012.11.13 |
---|---|
Oracle Database 10g SQL Fundamentals I - Practice 10 (0) | 2012.11.13 |
Set Operators (0) | 2012.11.13 |
Oracle Database 10g SQL Fundamentals I - Practice 7 (0) | 2012.11.13 |
Oracle Database 10g SQL Fundamentals I - Practice 6 (0) | 2012.11.12 |