首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
39
问题
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
微软认证
相关试题推荐
Severaltypesoffinancialriskareencounteredininternationalmarketing;themajorproblemsincludecommercial,political,an
Inthissection,youareaskedtowriteanessaybasedonthefollowinginformation.Makecommentsandexpressyourownopinion.
Writealettertoyouruniversitylibrary,makingsuggestionsforimprovingitsservice.Youshouldwriteabout100wordsonANS
SupposetheMartialArtAssociationinyouruniversitywantstorecruitnewmembers.Writeanadtoallstudentsto1)infor
Supposeyouaregoingtoresignfromyourcompanyforpersonalreasons.Writealetterofresignationtoyourmanagerto1)
DespiteincreasedairportsecuritysinceSeptember11th,2001,thetechnologytoscanbothpassengersandbaggageforweaponsan
EricHansenwritesabouttravelasaparticipatingenthusiastratherthanamereobserver.【T1】Itgivesthesenineessays,based
WhileAmericanshavebecomeevermoredependentuponelectricityintheirdailylives,acrucialpartofthesystemthatsupport
Inthe2006filmversionofTheDevilWearsPrada,MirandaPriestly,playedbyMerylStreep,scoldsherunattractiveassistant
UsingFacebookmakespeoplesadder,atleastaccordingtosomeresearch.Burjustwhatisitaboutthesocialnetworkthattakes
随机试题
生用行气力强,煨用力缓并止泻的药是
下列哪一项信息不属于《政府信息公开条例》所规定的政府信息?()
煤气作为气体燃料,具有输送方便,操作简单,燃烧均匀,温度、用量易于调节等优点,是工业生产的主要能源之一。下列关于煤气安全的说法,描述正确的是()。
下面关于人员疏散必须安全疏散时间构成的说法不正确的是()。
甲公司为一家拟上市的医药生产公司,该公司董事会目前正在审查公司的内部控制系统。甲公司管理层一直致力于实现最高水平的内部控制,以使股东对公司的管理层更加有信心,同时提高甲公司的社会信誉。但是最近甲公司的信誉由于内部出现的事件而受到了负面影响。事件的起因是,一
内宾团游客要求不随团离开而延长游期的,导游可以满足其要求,但需办理相关手续。()
鸦片战争以后,中国的社会性质发生质的变化,占支配地位的最主要矛盾是()
电子邮件客户端应用程序向邮件服务器发送邮件时使用(40)协议。下面关于 FTP叙述错误的是(41)。因特网上最重要、最基本的服务是(42)。下面描述的不是Internet提供的服务的选项是(43)。
TheUnitedStatesleadsallindustrialnationsintheproportionofitsyoungmenandwomenwhoreceivehighereducation.Whyis
A、Surprised.B、Skeptical.C、Disgusted.D、Alarmed.B
最新回复
(
0
)