首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
24
问题
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://kaotiyun.com/show/srhZ777K
本试题收录于:
微软70228题库微软认证分类
0
微软70228
微软认证
相关试题推荐
Chinaplanstospendbillionsofdollarsinthenextfewyearstodevelopmediaandentertainmentcompaniesthatithopescanco
[A]Thefirststepinpreparingamarketingplanisthatofproducingtheinformationnecessaryfordecision-making.Usually,a
CompanyIsMoreImportantthanGiftsWriteanessayof160-200wordsbasedonthedrawing.Inyouressay,youshould1)
Directions:Wesometimeshearthesadnewsofsuicideinuniversities.Isthereanywaytopreventthisfromhappeningagain
Artificialheartshavelongbeenthestuffofsciencefiction.In"Robocop",snazzycardiacdevicesaremadebyYamahaandJense
EricHansenwritesabouttravelasaparticipatingenthusiastratherthanamereobserver.【T1】Itgivesthesenineessays,based
Whethertheeyesare"thewindowsofthesoul"isdebatable;thattheyareintenselyimportantininterpersonalcommunicationis
InParagraphs1and2,thetextshowsPTK’s______.Skepticalobserversbelievethatancestrytestingfailsto______.
Superiorcustomerservicecanbeanessentialsourceofstrengthascompaniesemergefromtherecession,butmanagersneedtoun
Itwassupposedtobethenew-mediaelection.E-mail,blogging,socialnetworkingandtweetingwereexpectedtosurgeinimporta
随机试题
A.心脏停搏液B.头孢拉定C.硫酸镁注射液D.脂质体药物E.氨茶碱片B级高危药品是()。
对国外企业生产的药品进口审批取得的香港、澳门和台湾地区企业生产的药品进口内地经审批取得的是
孙某由于经营木材生意,被A区工商局和B市公安局联合执法,罚款1万元。现赔偿请求人孙某对A区工商局和B市公安局提起赔偿诉讼,应如何处理?()
×月×日16时48分,H省某县城关镇西街居民陈某家发生火药爆炸事故,共有1500kg制鞭炮用药物爆炸,冲击波波及300m,造成27人死亡,轻重伤18人。爆炸波及73户,严重损坏房屋141间,损坏各种家具、家用电器200多件,直接经济损失18.7万元。
下列合同履行的说法中正确的是()。
下列各项中,关于审判监督程序,说法不正确的是()。
赵某是某商业银行的一名信贷业务员,下列关于该银行向赵某发放贷款的表述中,正确的是()。
以下关于公文常识的说法正确的是()。
移植μC/OS—II到一个嵌入式系统电路板上正常运行,下面()条件不是必须的。
WhatissuggestedaboutTravelWelltravelbags?
最新回复
(
0
)