加入收藏 | 设为首页 | 会员中心 | 我要投稿 宁德站长网 (https://www.0593zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

使SQL Server 2005 数据表方案的更改不影响视图

发布时间:2021-01-11 08:05:57 所属栏目:MySql教程 来源:网络整理
导读:以下代码由PHP站长网 52php.cn收集自互联网 现在PHP站长网小编把它分享给大家,仅供参考 --购物车表 create table Cart( BookID int, BookName nvarchar(30), Quantity int, Status int ) --管理员表 create table admin( adminname nvarchar(15) primary

以下代码由PHP站长网 52php.cn收集自互联网

现在PHP站长网小编把它分享给大家,仅供参考

  --购物车表
  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,  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

以上内容由PHP站长网【52php.cn】收集整理供大家参考研究

如果以上内容对您有帮助,欢迎收藏、点赞、推荐、分享。

(编辑:宁德站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读