--게시판 테이블
CREATE TABLE BOARD(
BO_NO NUMBER(10) NOT NULL,
CA_CODE NUMBER(5) NOT NULL,
BO_TITLE VARCHAR2(300) NOT NULL,
BO_CONTENT LONG NOT NULL,
MEMBER_ID VARCHAR2(30) NOT NULL,
BO_COUNT NUMBER(10) DEFAULT 0 NOT NULL,
BO_TAG VARCHAR2(300),
BO_DELETE_YN VARCHAR2(10) DEFAULT 'N' NOT NULL,
PRIMARY KEY (BO_NO),
FOREIGN KEY (CA_CODE) REFERENCES CATEGORY(CA_CODE),
FOREIGN KEY (MEMBER_ID) REFERENCES MEMBER(MEMBER_ID),
CHECK (CA_CODE BETWEEN 1 AND 5), --테이블 카테고리번호는 1,2,3,4,5 로 제한한다.
CHECK (BO_DELETE_YN IN ('Y', 'N'))
);
ALTER TABLE BOARD ADD REGDATE DATE DEFAULT SYSDATE;
샘플데이터 추가
insert into BOARD values(2,3,'여행2','여행가고싶다2','ko1850',0,'#여행#여행','N',DEFAULT);
insert into BOARD values(3,3,'여행3','여행가고싶다3','ko1850',0,'#여행#여행','N',DEFAULT);
insert into BOARD values(4,3,'여행4','여행가고싶다4','ko1850',0,'#여행#여행','N',DEFAULT);
insert into BOARD values(5,3,'여행','여행가고싶다','ko1850',0,'#여행#여행','N',DEFAULT);
insert into BOARD values(6,3,'여행','여행가고싶다','ko1850',0,'#여행#여행','N',DEFAULT);
insert into BOARD values(7,3,'여행','여행가고싶다','ko1850',0,'#여행#여행','N',DEFAULT);
BOARD 테이블 컬럼 추가
샘플데이터 추가