티스토리 뷰

다음 표를 기반으로 테이블을 생성하십시오


A. 테이블 이름 : TITLE


Column Name

TITLE_ID

TITLE

DESCRIPTIONN

RATING

CATEGORY

RELEASE_DATE

Key Type

PK






Null / Unique


NN

NN




Check




G,

PG,

R,

NC17,

NR

DRAMA,

COMEDY,

ACTION,

CHILD,

SCIFI,

DOCUMENTARY


Data type

NUMBER

VARCHAR2

VARCHAR2

VARCAHR2

VARCHAR2

DATE

Length

10

60

400

4

20




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
CREATE TABLE title
(
    titlte_id NUMBER(10CONSTRAINT title_id_pk PRIMARY KEY,
    title VARCHAR2(60CONSTRAINT title_nn NOT NULL,
    description VARCHAR2(400CONSTRAINT desc_nn NOT NULL,
    rating VARCHAR2(4CONSTRAINT rating_ck CHECK
        (
            rating IN
            (
                'G',
                'PG',
                'R',
                'NC17',
                'NR'
            )
        ), 
    category VARCHAR2(20CONSTRAINT category_ck CHECK
        (
            category IN
            (
                'DRAMA',
                'COMEDY',
                'ACTION',
                'CHILD',
                'SCIFI',
                'DOCUMENTARY'
            )
        ),
    release_date DATE
);

cs



B. 테이블 이름 : TITLE_COPY


Column Name

COPY_ID

TITLE_ID

STATUS

Key Type

PK

PK FK


Null / Unique



NN

Check



AVAILABLE,

DESTROYED,

RENTED,

RESERVED

FK Table


TITLE


fk cOLUMN


TITLE_ID


Data type

NUMBER

NUMBER

VARCHAR2

Length

10

10

15



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CREATE TABLE title_copy
(
    copy_id NUMBER(10),
    title_id NUMBER(10CONSTRAINT title_id_fk REFERENCES title(title_id),
    status VARCHAR2(15CONSTRAINT status_nn NOT NULL
                        CONSTRAINT status_ck CHECK
                        (
                            status IN
                            (
                                'AVAILABLE',
                                'DESTROYED',
                                'RENTED',
                                'RESERVED'
                            )
                        )
    CONSTRAINT copy_title_id_pk PRIMARY KEY (copy_id, title-id)
);
cs 


공지사항
최근에 올라온 글
Total
Today
Yesterday