首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
49
问题
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
微软认证
相关试题推荐
Severaltypesoffinancialriskareencounteredininternationalmarketing;themajorproblemsincludecommercial,political,an
[A]Marketforglasscraftsisgrowing[B]Dependenceofcomputerdevelopmentonglass[C]Behindtheadaptabilityofglass[D]
Itneverrainsbutitpours.Justasbossesandboardshadfinallysortedouttheirworstaccountingandcompliancetroubles,an
Supposeyouarethepersonnelmanagerofacompanyandyou’vedecidedtheapplicantnamedZhangWeiisthebestcandidateforth
"Thisisareallyexcitingtime—aneweraisstarting,"saysPeterBazalgette,thechiefcreativeofficerofEndemol,thetelev
Intheidealizedversionofhowscienceisdone,factsabouttheworldarewaitingtobeobservedandcollectedbyobjectiveres
UsingFacebookmakespeoplesadder,atleastaccordingtosomeresearch.Burjustwhatisitaboutthesocialnetworkthattakes
Insectsaredisappearing.Theworldhas25percentfewerterrestrialinsectsnowthanin1990.Thisincludesthosewerelyon
Insectsaredisappearing.Theworldhas25percentfewerterrestrialinsectsnowthanin1990.Thisincludesthosewerelyon
Itwassupposedtobethenew-mediaelection.E-mail,blogging,socialnetworkingandtweetingwereexpectedtosurgeinimporta
随机试题
下列给定程序中,函数fun的功能是:计算一个带头结点的单向链表中各结点的数据域中数值之和,结果作为函数值返回。请在程序的下画线处填入正确的内容并将下画线删除,使程序得出正确的结果。注意:部分源程序给出如下。不得增行或删行,也不
设f(x)在[a,b]上连续且∫abf(x)dx=0,则________.
既能清热凉血,又能滋阴解毒的药物是
下列不属于护士收集资料方法的选项是
DSA减影图像中,留下的是含有对比剂的
心阳暴脱证与其他证型的主要鉴别症状是
政府性基金预算是国家通过向社会征收以及出让土地、发行彩票等方式取得政府性基金收入,其管理原则是()。
关于防水混凝土所用材料及配合比的说法,正确的有()。
社会主义市场经济与其他市场经济的共性不仅表现在市场机制对资源配置起基础性作用上,还表现在()等方面。
A、 B、 C、 D、 B第一组图中第三幅图与第一幅关于第二幅对称,故选D。
最新回复
(
0
)