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;