오라클

테스트 오라클 DB작성

오시리엔 2023. 8. 24. 11:16

CREATE TABLE client (

client_id varchar2(20)primary key,

client_password varchar2(16)NOT NULL,

client_nickname varchar2(30) unique NOT NULL,

client_grade varchar2(9) NOT NULL

check(client_grade in ('일반','우수','관리자','VIP')),

client_join date default sysdate NOT NULL,

client_point number default 0 NOT NULL check(client_point >= 0)

);

 

 

 

DROP table client ;

 

 

 

CREATE TABLE item (

item_no number primary key,

item_name varchar2(60)NOT NULL,

item_price number check(item_price >= 0) NOT NULL,

item_regist date default sysdate NOT NULL

);

DROP table item ;

 

CREATE SEQUENCE item_no_seq;

 

CREATE TABLE basket (

basket_no number primary key,

basket_user varchar2(20)references client(client_id) on DELETE cascade,

basket_item number references item(item_no) on DELETE cascade,

basket_time date default sysdate NOT NULL,

basket_qty number default 1 NOT NULL

);

 

CREATE SEQUENCE basket_no_seq;

 

 

 

 

 

 

'오라클' 카테고리의 다른 글

오라클 세팅법  (0) 2023.08.20