首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
You are the administrator of a SQL Server 2000 computer. The server contains a database named Inventory. In this database, the P
You are the administrator of a SQL Server 2000 computer. The server contains a database named Inventory. In this database, the P
admin
2009-05-19
41
问题
You are the administrator of a SQL Server 2000 computer. The server contains a database named Inventory. In this database, the Parts table has a primary key that is used to identify each part stored in the company’s warehouse. Each part has a unique UPC code that your company’s accounting department uses to identify it. The database is configured as shown in the exhibit.
You want to maintain the referential integrity between the Parts table and the OrderDetails table. You want to minimize the amount of physical I/O that is used within the database.
Which two Transact-SQL statements should you execute? (Each correct answer represents part of the solution. Choose two.)
A. CREATE UNIQUE INDEX IX_UPC On Parts(UPC)
B. CREATE UNIQUE INDEX IX_UPC On OrderDetails(UPC)
C. CREATE TRIGGER UPCRI On OrderDetails
FOR INSERT, UPDATE As
If Not Exists (Select UPC From Parts
Where Parts.UPC = inserted.UPC) BEGIN
ROLLBACK TRAN
END
D. CREATE TRIGGER UPCRI On Parts
FOR INSERT, UPDATE As
If Not Exists (Select UPC From Parts
Where OrderDetails.UPC = inserted.UPC) BEGIN
ROLLBACK TRAN
END
E. ALTER TABLE dbo.OrderDetails ADD CONSTRAINT
FK_OrderDetails_Parts FOREIGN KEY(UPC)
REFERENCES dbo.Parts(UPC)
F. ALTER TABLE dbo.Parts ADD CONSTRAINT
FK_Parts_OrderDetails FOREIGN KEY (UPC)
REFERENCES dbo.Parts(UPC)
选项
答案
A,E
解析
Explanation:
A: The unique index on the UPC column must be created in the Parts table since every part has an unique UPC code.
E: One Part row can be contained in many OrderDetails, but each OrderDetail row only corresponds to one specific row in the Part table. There is a one-to-many relation between the Part table and the OrderDetails table. Therefore the foreign key constraint must be defined on the OrderDetails table referencing the UPC column of the Parts table.
Incorrect Answers:
B: Each part has a unique UPC code, but each part can be included in many rows in the OrderDetails table since many different orders can contain the same part. We cannot use a unique index on the UPC column in the OrderDetails table.
C: Referential integrity is best implemented with foreign key constraints not by triggers.
D: Referential integrity is best implemented with foreign key constraints not by triggers.
F: The foreign key constraint must be from the OrderDetails table referencing the UPC column in the Parts table.
If we have a foreign key constraint from the Parts table referencing the UPC column in the OrderDetails table we would have that each Part only can be part of one OrderDetails, but that one OrderDetails row could correspond to several rows. But it should be the opposite.
转载请注明原文地址:https://www.kaotiyun.com/show/srhZ777K
本试题收录于:
微软70228题库微软认证分类
0
微软70228
微软认证
相关试题推荐
About3billionpeoplelivewithin100milesofthesea,anumberthatcoulddoubleinthenextdecadeashumansflocktocoasta
Cancerisusedgenericallyformorethan100differentdiseases,includingmalignanttumoursofdifferentsites,suchasbreast,
Despitethemountainsofinformationwarningusofthedangerofsmoking,teenagersmokingisontherise.Inthissection,you
Supposeyouwanttoapplyforajobinacompanyasanofficesecretary.Writeanapplicationemailto1)introduceyourself
Supposeyouorderedahairdryeronlineatthecostof$22,butonlyreceivedanemptypackagebox.Somethingmustbewrong.Wri
In2016,manyshoppersoptedtoavoidthefreneticcrowdsanddotheirholidayshoppingfromthecomfortoftheircomputer.But
WhileAmericanshavebecomeevermoredependentuponelectricityintheirdailylives,acrucialpartofthesystemthatsupport
MireilleGuiliano,achampagnecompanyexecutive,capturedtheattentionoffrustrateddieterswithherjoyoflifeinthe2005
BedwettingMillionsofkidsandteenagersfromeverypartoftheworldwetthebedeverysinglenight.It’ssocommonthatt
如果WindowsXP能够识别网络适配器如何安装网络适配器。
随机试题
A.双卵双胎B.单卵双胎,双羊膜囊,双绒毛膜C.单羊膜囊双胎妊娠D.联体儿E.单卵双胎,双羊膜囊,单绒毛膜分裂发生在晚期囊胚即受精后4~8天为
痿证的主要临床表现是
以下属于二萜的是()。
甲到乙医院做隆鼻手术效果很好。乙为了宣传,分别在美容前后对甲的鼻子进行拍照(仅见鼻子和嘴部),未经甲同意将照片发布到丙网站的广告中,介绍该照片时使用甲的真实姓名。丙网站在收到甲的异议后立即作了删除。下列哪一说法是正确的?(2011年卷三第24题)
下列有关灌砂法测试现场密度的说法中,正确的是()。
某大底盘单塔楼高层建筑,主楼为钢筋混凝土框架—核心筒,与主楼连为整体的裙房为混凝土框架结构,如题图所示:本地区抗震设防烈度为7度,建筑场地为Ⅱ类。假定该房屋为乙类建筑,试问,裙房框架结构用于抗震措施的抗震等级,应如下列()项所示。
提出货物索赔的人原则上是货物所有人,或提单上记载的收货人或合法的提单持有人。但是,根据收货人提出的(),也可以由有代位求偿权的货物保险人或其他有关当事人提出索赔。
做好班主任工作的前提和基础是()。
2014年、2015年的第一次国务院常务会议,都研究了简政放权。2014年共开了40次常务会议,有21次部署了“简政放权”。其效果主要是()。
【S1】【S3】
最新回复
(
0
)