create table customer(
customerID varchar(32),
customerName varchar(255) null,
phone varchar(20) null,
address varchar(255) null,
contacts varchar(30) null,
other varchar(255) null,
primary key(customerID)
)
create table productType(
productTypeID varchar(32),
productTypeName varchar(100) null,
primary key(productTypeID)
)
create table product(
productID varchar(32) not null,
productTypeID varchar(32) null,
productName varchar(255) null,
producingArea varchar(255) null,
productOwner varchar(255) null,
make varchar(10) null,
price varchar(10) null,
quantity varchar(10) null,
other varchar(255) null,
primary key(productID)
)
create table orderi (
orderID varchar(32) not null,
customerID varchar(32) null,
productID varchar(32) null,
quantity varchar(10) null,
ordertime datetime null,
other varchar(255) null,
primary key (orderID)
)
create table quotation(
quotationID varchar(32),
productID varchar(32) null,
customerID varchar(32) null,
quotationMan varchar(32) null,
quotationtime datetime null,
other varchar(255) null,
primary key(quotationID)
)
alter table product
add foreign key (productTypeID) references producttype(productTypeID)
alter table orderi
add foreign key (customerID) references customer(customerID),
add foreign key (productID) references product(productID)
alter table quotation
add foreign key (customerID) references customer(customerID),
add foreign key (productID) references product(productID)
customerID varchar(32),
customerName varchar(255) null,
phone varchar(20) null,
address varchar(255) null,
contacts varchar(30) null,
other varchar(255) null,
primary key(customerID)
)
create table productType(
productTypeID varchar(32),
productTypeName varchar(100) null,
primary key(productTypeID)
)
create table product(
productID varchar(32) not null,
productTypeID varchar(32) null,
productName varchar(255) null,
producingArea varchar(255) null,
productOwner varchar(255) null,
make varchar(10) null,
price varchar(10) null,
quantity varchar(10) null,
other varchar(255) null,
primary key(productID)
)
create table orderi (
orderID varchar(32) not null,
customerID varchar(32) null,
productID varchar(32) null,
quantity varchar(10) null,
ordertime datetime null,
other varchar(255) null,
primary key (orderID)
)
create table quotation(
quotationID varchar(32),
productID varchar(32) null,
customerID varchar(32) null,
quotationMan varchar(32) null,
quotationtime datetime null,
other varchar(255) null,
primary key(quotationID)
)
alter table product
add foreign key (productTypeID) references producttype(productTypeID)
alter table orderi
add foreign key (customerID) references customer(customerID),
add foreign key (productID) references product(productID)
alter table quotation
add foreign key (customerID) references customer(customerID),
add foreign key (productID) references product(productID)