Create Database b2cshopdb
Use b2cshopdb
Create Table users
(
Userid int identity (1, 1) primary key,
Username varchar (32 ),
Password varchar (32 ),
Address varchar (200 ),
Telephone varchar (12 ),
Email varchar (30 ),
State int
)
Go
Select * from users
Insert into users (username, password, address, telephone, email, state) values ('admin', 'admin', 'address', '123', 'long11310 @ 163.com ', '1 ')
Create Table companys
(
Companyid int identity (1, 1) primary key,
Name varchar (32 ),
December varchar (1000 ),
Address varchar (200 ),
Telephone varchar (20 ),
Email varchar (50 ),
)
Go
Insert into companys (name, decimal, address, telephone, email) values ('Company name', 'Company introduction', 'Company address', '123 ', 'gongsi @ 163.com ')
Select * From companys
Go
Create Table categorys
(
Categoryid int identity (1, 1) primary key,
Description varchar (100 ),
)
Go
Insert into categorys (description) values ('Type details description ')
Insert into categorys (description) values ('Type description 2 ')
Go
Select * From categorys
Create Table Products
(
Productid int identity (1, 1) primary key,
Description varchar (2000 ),
Pictureid int,
Companyid int,
Categoryid int,
Quantity int,
Price money,
Pubdate datetime default (getdate ()),
Details1 text,
Details2 text,
Details3 text,
Details4 text,
Details5 text,
)
Go
Insert into products (description, pictureid, companyid, categoryid, quantity, price, details1, details2, details3, details4, details5) values ('item description name', '1 ', '1', '1', '000000', 200, 'commodity detailed attribute description', 'commodity detailed attribute description2', 'commodity detailed attribute description ', 'item details attribute description 4', 'item details attribute description 5 ')
Insert into products (description, pictureid, companyid, categoryid, quantity, price, details1, details2, details3, details4, details5) values ('item description name 2', '2 ', '1', '1', '000000', 400, 'item detailed attribute description 1-2 ', 'item detailed attribute description 2-2', 'item detailed attribute description 3-2 ', 'product details attributes 4-2 ', 'product details attributes 5-2 ')
Go
Select * from products
Go
Create Table shopcarts
(
Shopcartid int identity (1, 1) primary key,
Userid int,
Pubdate datetime default (getdate ()),
Totalnum int,
Totalprice int,
)
Go
Insert into shopcarts (userid, totalnum, totalprice) values ('1', '20', '123 ')
Go
Select * From shopcarts
Go
Create Table productcarts
(
Productid int,
Shopcartid int,
Quantity int,
)
Go
Insert into productcarts (productid, shopcartid, quantity) values ('1', '1', '20 ')
Go
Select * From productcarts
Go
Create Table pictures
(
Pictureid int identity (1, 1) primary key,
Title varchar (50 ),
Pictureurl varchar (100 ),
)
Go
Insert into pictures (title, pictureurl) values ('image description', 'pic/1.jpg ')
Insert into pictures (title, pictureurl) values ('image description 2', 'pic/2.jpg ')
Go
Go
Select * from pictures
Go
Create Table Admin
(
Adminid int identity (1, 1) primary key,
Username varchar (32 ),
Password varchar (32 ),
State int,
)
Insert into admin (username, password, state) values ('admin', 'admin', '2 ')
Select * from Admin