【SQL开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了SQL开源代码-quote.sql的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
/*==============================================================*/
/* DBMS name: Microsoft SQL Server 2000 */
/* Created on: 2005-10-4 16:39:49 */
/*==============================================================*/
if exists (select 1
from sysindexes
where id = object_id('order')
and name = 'Relationship_4_FK'
and indid > 0
and indid < 255)
drop index order.Relationship_4_FK
go
if exists (select 1
from sysindexes
where id = object_id('order')
and name = 'Relationship_5_FK'
and indid > 0
and indid < 255)
drop index order.Relationship_5_FK
go
if exists (select 1
from sysindexes
where id = object_id('product')
and name = 'Relationship_1_FK'
and indid > 0
and indid < 255)
drop index product.Relationship_1_FK
go
if exists (select 1
from sysindexes
where id = object_id('quotation')
and name = 'Relationship_2_FK'
and indid > 0
and indid < 255)
drop index quotation.Relationship_2_FK
go
if exists (select 1
from sysindexes
where id = object_id('quotation')
and name = 'Relationship_3_FK'
and indid > 0
and indid < 255)
drop index quotation.Relationship_3_FK
go
if exists (select 1
from sysobjects
where id = object_id('customer')
and type = 'U')
drop table customer
go
if exists (select 1
from sysobjects
where id = object_id('order')
and type = 'U')
drop table order
go
if exists (select 1
from sysobjects
where id = object_id('product')
and type = 'U')
drop table product
go
if exists (select 1
from sysobjects
where id = object_id('producttype')
and type = 'U')
drop table producttype
go
if exists (select 1
from sysobjects
where id = object_id('quotation')
and type = 'U')
drop table quotation
go
/*==============================================================*/
/* Table: customer */
/*==============================================================*/
create table customer (
customercode varchar(32) not null,
customername varchar(255) null,
phone varchar(20) null,
address varchar(255) null,
relationman varchar(30) null,
other varchar(255) null,
constraint PK_CUSTOMER primary key (customercode)
)
go
/*==============================================================*/
/* Table: order */
/*==============================================================*/
create table order (
ordercode varchar(32) not null,
customercode varchar(32) null,
productcode varchar(32) null,
quantity varchar(10) null,
ordertime datetime null,
other varchar(255) null,
constraint PK_ORDER primary key (ordercode)
)
go
/*==============================================================*/
/* Index: Relationship_4_FK */
/*==============================================================*/
create index Relationship_4_FK on order (
customercode
)
go
/*==============================================================*/
/* Index: Relationship_5_FK */
/*==============================================================*/
create index Relationship_5_FK on order (
productcode
)
go
/*==============================================================*/
/* Table: product */
/*==============================================================*/
create table product (
productcode varchar(32) not null,
producttypecode varchar(32) null,
productname varchar(255) null,
producingarea varchar(255) null,
productowner varchar(255) null,
unit varchar(10) null,
price varchar(10) null,
quantity varchar(10) null,
other varchar(255) null,
constraint PK_PRODUCT primary key (productcode)
)
go
/*==============================================================*/
/* Index: Relationship_1_FK */
/*==============================================================*/
create index Relationship_1_FK on product (
producttypecode
)
go
/*==============================================================*/
/* Table: producttype */
/*==============================================================*/
create table producttype (
producttypecode varchar(32) not null,
producttypename varchar(100) null,
constraint PK_PRODUCTTYPE primary key (producttypecode)
)
go
/*==============================================================*/
/* Table: quotation */
/*==============================================================*/
create table quotation (
quotationcode varchar(32) not null,
productcode varchar(32) null,
customercode v