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

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

发布时间:2020-05-23 07:22:31 所属栏目:MySql 来源:互联网
导读:使SQL Server 2005 数据表方案的更改不影响视图

下面是脚本之家 jb51.cc 通过网络收集整理的代码片段。

脚本之家小编现在分享给大家,也给大家做个参考。

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

以上是脚本之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。

如果觉得脚本之家网站内容还不错,欢迎将脚本之家网站推荐给程序员好友。

(编辑:安卓应用网)

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

    推荐文章
      热点阅读