首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
20
问题
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://jikaoti.com/ti/ZVO7FFFM
本试题收录于:
微软70228题库微软认证分类
0
微软70228
微软认证
相关试题推荐
Menandwomendothinkdifferently,atleastwheretheanatomyofthebrainisconcerned,accordingtoanewstudy.Thebrainis
MusicalTrainingCanImproveCommunicationSkillsAmericanscientistssaymusicaltrainingseemstoimprovecommunicationsk
[A]Butworkisunderwaytogetcomputerstocapturehumanlifeandrememberitaspeopledo—recallingbitsofexperiencethata
Thenewaircraftrepresentsa$250mbetbyBombardierthatMexicocouldprovidenotjustroutinelabourbutmanufacturingthat
Thenewaircraftrepresentsa$250mbetbyBombardierthatMexicocouldprovidenotjustroutinelabourbutmanufacturingthat
Cancerisusedgenericallyformorethan100differentdiseases,includingmalignanttumoursofdifferentsites,suchasbreast,
Directions:Writeanessaybasedonthedrawing.Inyourwriting,youshould1)describethedrawingbriefly,2)exp
Thepicturedepictsafunnysceneinthehospitalvividly.Severalpeoplearewaitinginquitealongqueueoutsidetheclinicw
Whethertheeyesare"thewindowsofthesoul"isdebatable;thattheyareintenselyimportantininterpersonalcommunicationis
Itwassupposedtobethenew-mediaelection.E-mail,blogging,socialnetworkingandtweetingwereexpectedtosurgeinimporta
随机试题
债权人会议通过和解协议草案的决议,由()通过,并且其所代表的债权额,必须占:()
中国特色社会主义政治发展道路,是近代以来中国人民长期奋斗历史逻辑、理论逻辑、实践逻辑的必然结果,是坚持党的本质属性、践行党的根本宗旨的必然要求。走中国特色社会主义政治发展道路,必须坚持的中国特色社会主义政治制度有()
寻找潜在顾客的途径有_______方式。
A.保和丸B.清中汤C.半夏泻心汤D.柴胡疏肝散E.黄芪建中汤治疗胃痛脾胃虚寒证,应首选的方剂是()
根据企业国有产权无偿划转的有关规定,下列选项中,企业国有产权不得实施无偿划转的情形有()。
借款人履行债务的期限条款属于借款合同审查的必备条款。()
刘老师家庭负担重,老人要看病,孩子要读书,于是用假名在培训机构上课,挣钱补贴生活。这种行为()
学习障碍的表现包括()。
新中国成立之初,在国民经济恢复时期,我国社会主要矛盾是()
设有定义语句:inta[][3]={{0},{1},{2}};,则数组元素a[1][2]的值为()。
最新回复
(
0
)