建表语句
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
1, 商品信息表 product_info
-- Create table
create table product_info
(
product_id number(10) not null,
product_no number(10) not null,
product_name varchar2(40) not null,
unit varchar2(10) not null,
price number(10) not null,
cost number(10) not null,
provider varchar2(50) not null,
can_return varchar2(10) not null,
warn_account number(10) not null,
max_account number(10) not null,
can_change varchar2(10) not null
);
-- Create/Recreate primary, unique and foreign key constraints alter table product_info
add constraint product_id_pk primary key (PRODUCT_ID);
alter table product_info
add constraint product_no_uk unique (PRODUCT_NO);
alter table product_info
add constraint product_name_uk unique (PRODUCT_NAME);
=====================================================
2, 库房信息表 warehouse_info
-- Create table
create table warehouse_info
(
warehouse_id number(10) not null,
warehouse_name varchar2(20) not null,
warehouse_add varchar2(50) not null,
warehouse_admin varchar2(10) not null,
warehouse_grade varchar2(10) not null
);
-- Create/Recreate primary, unique and foreign key constraints alter table warehouse_info
add constraint warehouse_id_pk primary key (WAREHOUSE_ID); alter table warehouse_info
add constraint warehouse_name_uk unique (WAREHOUSE_NAME);
=================================================
3, 购货单表 inport_info
create table inport_info
(
inport_id number(10) not null,
inport_no number(10) not null,
product_id number(10) not null,
short_account number(10) not null,
inport_account number(10) not null,
decision varchar2(20) not null,
inport_time date not null
);
-- Create/Recreate primary, unique and foreign key constraints alter table inport_info
add constraint inport_id_pk primary key (INPORT_ID);
alter table inport_info
add constraint inport_no_uk unique (INPORT_NO);
alter table inport_info
add constraint product_id_fk foreign key (PRODUCT_ID)
references product_info (PRODUCT_ID);
===================================================
4, 出入库单表inout_info
-- Create table
create table inout_info
(
inout_id number(10) not null,
inout_no number(10) not null,
warehouse_id number(10) not null,
inout_type varchar2(10) not null,
product_id number(10) not null,
inout_account number(10) not null,
inout_date date not null
);
-- Create/Recreate primary, unique and foreign key constraints alter table inout_info
add constraint inout_id_pk primary key (INOUT_ID);
alter table inout_info
add constraint inout_no_uk unique (INOUT_NO);
alter table inout_info
add constraint product_id foreign key (PRODUCT_ID)
references product_info (PRODUCT_ID);
====================================================
5, 客户信息表customer_info