码迷,mamicode.com
首页 > 其他好文 > 详细

实验11-03 创建借阅表

时间:2018-07-18 18:05:01      阅读:303      评论:0      收藏:0      [点我收藏+]

标签:wp8   VRM   aapt   sel   cgo   jci   padding   hnu   nas   

请在Exam数据库中创建借阅表,结构如下:

技术分享图片

要求在bno和rno上建立外键关系。

 

USE [Exam]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[borrow](
	[borrowno] [int] NOT NULL,
	[bno] [char](4) NULL,
	[rno] [char](4) NULL,
	[borrowdate] [datetime] NULL,
 CONSTRAINT [PK_borrow] PRIMARY KEY CLUSTERED 
(
	[borrowno] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[borrow]  WITH CHECK ADD  CONSTRAINT [FK_borrow_book] FOREIGN KEY([bno])
REFERENCES [dbo].[book] ([bno])
GO
ALTER TABLE [dbo].[borrow] CHECK CONSTRAINT [FK_borrow_book]
GO
ALTER TABLE [dbo].[borrow]  WITH CHECK ADD  CONSTRAINT [FK_borrow_reader] FOREIGN KEY([rno])
REFERENCES [dbo].[reader] ([rno])
GO
ALTER TABLE [dbo].[borrow] CHECK CONSTRAINT [FK_borrow_reader]

  

实验11-03 创建借阅表

标签:wp8   VRM   aapt   sel   cgo   jci   padding   hnu   nas   

原文地址:https://www.cnblogs.com/masterchd/p/9330676.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!