你需要在 SQL Server 2005 数据库中创建一个连接客户表与订单表的视图。同时要确保底层数据表方案的更改不会影响到视图。 以可能的最小开销量达成此目标。 无 --购物车表 create table Cart( BookID int, BookName nvarchar(30), Quantity int, Status int )
你需要在 SQL Server 2005 数据库中创建一个连接客户表与订单表的视图。同时要确保底层数据表方案的更改不会影响到视图。 以可能的最小开销量达成此目标。 <无>--购物车表 create table Cart( BookID int, BookName nvarchar(30), Quantity int, Status int ) --管理员表 create table admin( adminname nvarchar(15) primary key, Pws varchar(15) not null) --图书表 create table books( Idbook int primary key, Idcategory int not null references categories(Idcategory), Idsubcategory int not null references subcategories(Idsubcategory), Idsupplier int not null references suppliers(Idsupplier), bookname nvarchar(30) not null, Isbn varchar(13) not null, Details nvarchar(300) null, Orgcost money not null, Price money not null, discount int not null, imageurl nvarchar(50) null, Stock int not null, availstock int not null, Active bit not null, Hotdeal bit not null, Sakes int not null, Visits int not null ) --图书类表 create table categories( Idcategory int primary key, categoryname nvarchar(20) not null) --子类表 create table subcategories( Idsubcategory int primary key, subcategoryname nvarchar(20) not null, Idcategory int references categories(Idcategory) ) --出版商表 create table suppliers( Idsupplier int primary key, suppliername nvarchar(30) not null ) --顾客表 create table customers( Idcustomer int primary key, username nvarchar(15) not null, password varchar(15) not null, realname nvarchar(15) not null, phone varchar(19) not null, email varchar(30) null, [add] nvarchar(30) not null, City nchar(10) not null, State nchar(10) not null, Zip char(6) not null ) --订单表 create table orders( Idorder int primary key, orderdate datetime not null default getdate(), Idcustomer int not null references customers(Idcustomer), Idbook int not null references books(Idbook), totalmoney money not null, totalbooks int not null, [add] nvarchar(30) not null, City nchar(10) not null, State nchar(10) not null, comment nvarchar(300) null, Idpayment int not null, Send bit not null ) --stockmovements表 create table stockmovements( Idbook int not null, Datemovement datetime not null, Quantity int not null ) GO CREATE VIEW dbo.Customer_Order WITH SCHEMABINDING AS SELECT * FROM dbo.customers INNER JOIN dbo.orders ON dbo.orders.Idcustomer=dbo.customers.Idcustomer GO
已抢17256个
抢已抢50194个
抢已抢121301个
抢已抢184564个
抢已抢66403个
抢已抢350862个
抢