/*使用数据库*/
use master
go
/*建立数据库*/
if exists(select * from sysdatabases
where name='dbShowppingOnline')
drop database dbShowppingOnline
go
create database dbShowppingOnline
on
(name='dbShowppingOnline_data',filename='F:\数据库\dbShowppingOnline.mdf',
size=20,maxsize=50,filegrowth=10)
log on
(name='dbShowppingOnline_log',filename='F:\数据库\dbShowppingOnline.ldf',
size=10,maxsize=40,filegrowth=5)
go
/*建立用户留言表*/
use dbShowppingOnline
go
if exists(select * from sysobjects
where name='blog' )
drop table blog
go
create table blog
(
blod_ID int identity(1,1) not null primary key,
blog_Info varchar(5000),
blog_date datetime,
userName varchar(50) not null ,
ProductID int not null constraint B_ProductID foreign key(ProductID) references ProductDetailes(ProductID)
)
go
select * from blog
insert into blog(blog_Info,blog_date,userName,ProductID) values('你好',getdate(),'大海',24)
go
/*使用数据库建立用户表*/
use dbShowppingOnline
go
if exists(select * from sysobjects
where name='tbUser')
drop table tbUser
go
create table tbUser
(
userID varchar(50) not null primary key,
userName varchar(50),
pwd varchar(50) not null,
Sex varchar(2),
Phone varchar(50),
QQ varchar(20),
Email varchar(30),
age varchar(10),
favorite varchar(6)
)
go
insert into tbUser values('liang','liang','liang','男','13037172987','501756766','501756766@qq.com','18','阅读')
insert into tbUser values('lian','liang','liang','男','13037172987','501756766','501756766@qq.com','18','阅读')
/*建立管理员信息表*/
use dbShowppingOnline
go
if exists(select * from sysobjects
where name='tbAdmin')
drop table tbAdmin
go
create table tbAdmin
(
Admin_ID varchar(20) not null primary key,
Admin_Pwd varchar(20) not null,
Admin_Name varchar(20) not null,
Admin_Sex varchar(2) not null
)
go
insert into tbAdmin values('admin','admin','\(^o^)/~','女')
select * from tbAdmin
/*使用数据库,建商品表*/
use dbShowppingOnline
go
if exists(select * from sysobjects
where name='ProductDetailes')
drop table ProductDetailes
go
create table ProductDetailes
(
ProductID int not null primary key,/*商品编号*/
Productphoto varchar(50), /*商品图片*/
ProductName varchar(50), /*商品名称*/
ProductSort varchar(50), /*类别*/
Precessor varchar(50), /*处理器*/
Memory varchar(50), /*内存*/
Harddisk varchar(50), /*硬盘容量*/
Screen varchar(50), /*屏幕尺寸*/
GraphicsCard varchar(50), /*显卡芯片*/
WorkWindow varchar(50), /*操作系统*/
Productdate datetime, /*生产日期*/
Marketdate datetime, /*上市时间*/
ProductMan varchar(50), /*生产厂商*/
Price money, /*价格*/
Freight varchar(50) /*运费*/
)
go
insert into ProductDetailes values(17,'../../images/17.png','神舟优雅A560笔记本电脑','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'方正','145.56','13元')
insert into ProductDetailes values(19,'../../images/19.png','联想昭阳E430办公型笔记本电脑','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'清华','25.56','11元')
insert into ProductDetailes values(20,'../../images/20.png','IBM狂摔型笔记本电脑','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'华硕','35.56','10元')
insert into ProductDetailes values(21,'../../images/21.png','惠普','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'神州','45.56','8元')
insert into ProductDetailes values(24,'../../images/24.png','华硕','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'神州','55.56','4元')
insert into ProductDetailes values(25,'../../images/25.png','方正','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'惠普','65.56','5元')
insert into ProductDetailes values(26,'../../images/26.png','清华','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'神州','75.56','11元')
insert into ProductDetailes values(27,'../../images/27.png','长城','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'苹果','85.56','19元')
insert into ProductDetailes values(28,'../../images/28.png','惠普','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'神州','95.56','7元')
insert into ProductDetailes values(29,'../../images/29.png','方正','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'Apple','105.56','45元')
insert into ProductDetailes values(30,'../../images/30.png','联想昭阳E430办公型笔记本电脑','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'神州','110.56','23元')
insert into ProductDetailes values(31,'../../images/31.png','神舟优雅A560游戏型笔记本电脑','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'联想','121.56','0元')
insert into ProductDetailes values(32,'../../images/32.png','联想昭阳E430办公型笔记本电脑','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'华硕','111.56','0元')
insert into ProductDetailes values(33,'../../images/33.png','神舟优雅A560游戏型笔记本电脑','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'神州','145.56','0元')
insert into ProductDetailes values(34,'../../images/34.png','IBM狂摔型笔记本电脑','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'神州','415.56','0元')
insert into ProductDetailes values(35,'../../images/35.png','联想昭阳E430办公型笔记本电脑','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'联想','445.56','1元')
insert into ProductDetailes values(36,'../../images/36.png','神舟优雅A560游戏型笔记本电脑','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'神州','425.56','1元')
insert into ProductDetailes values(37,'../../images/37.png','IBM狂摔型笔记本电脑','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'惠普','405.56','23元')
insert into ProductDetailes values(38,'../../images/38.png','神舟优雅A560游戏型笔记本电脑','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'联想','214.56','93元')
insert into ProductDetailes values(39,'../../images/39.png','IBM狂摔型笔记本电脑','笔记本','Inter Core i3-330M(2.13Ghz)','2.0GB','320GB','17英寸','NVIDIA Geforce GT 355M','Windows7 系列',1990-09-09,1990-09-09,'联想','24.56','7元')
select * from ProductDetailes Where ProductMan like '%神%'
--建立订单表
use dbShowppingOnline
go
if exists(select * from sysobjects
where name='tbOrder')
drop table tbOrder
go
create table tbOrder
(
Order_ID varchar(50) not null primary key, /*订单编号*/
Order_TotalPrice varchar(20) not null , /*总价格*/
Order_Date datetime, /*日期*/
priceway varchar(50) not null, /*运送