由于blog显示问题,仅上传建用户和建数据库对象的sql脚本,字段说明等从略
脚本
--create user
create user store identified by store
default tablespace users
temporary tablespace temp;
grant connect,resource to store;
--create table customer
create table Customer
(Cst_ID Varchar2(6) not null,
Cst_Name Varchar2(50) not null,
Cst_Sex Varchar2(2) not null,
Cst_Year Varchar2(4),
Cst_Month varchar2(2),
Cst_Address Varchar2(100),
Cst_Zip_code Varchar2(6),
Cst_Ph_office Varchar2(20),
Cst_Ph_home Varchar2(20),
Cst_Mobile Varchar2(20),
Cst_Email Varchar2(50),
Cst_Discount Number not null,
Cst_trd_sum Number not null,
Cst_Crt_Date Date not null,
Cst_Upt_Date Date not null)
/
alter table customer add constraint cst_pk
primary key(cst_id)
/
--create table commodity
create table commodity
(COMM_ID Varchar2(10) not null,
COMM_NAME Varchar2(50) not null,
COMM_CATE Varchar2(20),
COMM_UNIT Number,
COMM_QUTT Number not null,
COMM_UPT_DATE Date not null,
COMM_COLOR Varchar2(10),
COMM_SIZE Number)
/
alter table commodity add constraint cmmt_pk
primary key(comm_id)
/
--create table exchange
create table exchange
(EXCH_SEQ Number not null,
EXCH_CST_ID Varchar2(6) not null,
EXCH_COMM_ID Varchar2(10) not null,
EXCH_NB Number not null,
EXCH_Mon Number not null,
EXCH_DATE Date,
EXCH_TYPE Varchar2(2) not null)
/
alter table exchange add constraint exch_pk
primary key(exch_seq,exch_cst_id,exch_comm_id,exch_date)
/
alter table exchange add constraint exch_cst_fk
foreign key(exch_cst_id) references customer(cst_id)
/
alter table exchange add constraint exch_comm_fk
foreign key(exch_comm_id) references commodity(comm_id)
/
交易类型 exch_type:
A: 总公司的发货单、
B: 本店制作的退货单、
C: 销货发票、
D: 销售/购买、
E: 退货、
F: 处理、
预留的顾客卡号:
客户卡号 ‘000000’为表示商品进货上家
客户卡号 ‘000001’表示处理商品的客户
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/207/viewspace-799068/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/207/viewspace-799068/