首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
46
问题
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
微软认证
相关试题推荐
[A]Thefirststepinpreparingamarketingplanisthatofproducingtheinformationnecessaryfordecision-making.Usually,a
Afterthedotcomboomofthe1990s,theworldisabouttoexperienceaboomindots.Over1,000newgenerictop-leveldomainnam
[A]Marketforglasscraftsisgrowing[B]Dependenceofcomputerdevelopmentonglass[C]Behindtheadaptabilityofglass[D]
MusicalTrainingCanImproveCommunicationSkillsAmericanscientistssaymusicaltrainingseemstoimprovecommunicationsk
Rao’s,thelegendaryeastHarlemItalianeatery,ismorethanahundredblocksaboveWallStreet.Butwithaclientelethatincl
Itneverrainsbutitpours.Justasbossesandboardshadfinallysortedouttheirworstaccountingandcompliancetroubles,an
Directions:Wesometimeshearthesadnewsofsuicideinuniversities.Isthereanywaytopreventthisfromhappeningagain
Directions:Writeanessaybasedonthedrawing.Inyourwriting,youshould1)describethedrawingbriefly,2)exp
Conversationsaboutelderlyparentsandtechnologyusuallycenteronsafety,inparticularondevicesdesignedtoalertacallc
Thehumanbraincontains10thousandmillioncellsandeachofthesemayhaveathousandconnections.Suchenormousnumbersused
随机试题
我国《固体废物污染环境防治法》对该法所要管制的固体废物采取了概括性规定,该法主要防治三类固体废物,即工业固体废物、生活垃圾以及【】
阅读诗歌片段,回答问题:寻梦?撑一支长篙,向青草更青处漫溯;满载一船星辉,在星辉斑斓里放歌。但我不能放歌,悄悄是别离的笙箫;夏虫也为我沉默,沉默是今晚的康桥!这段文字表达了诗人怎样的情感?
符合高能磷酸键的叙述是
无筋扩展基础台阶宽高比的允许值与下列哪一因素无关?
仲裁协议的效力体现在()。
下列是我国小学生的一些需要,依据马斯洛的需要层次理论,选项中层次最高的是()
特急秘密××局办公室文件×发(13)第023号请求同意增加人员编制的报告编制办:随着改革开放形势的发展,我局事业蒸蒸日上,人手不足问题日益严重,机关每个工作人员每天都处在十分紧张、经常加班加点的状态下,身心疲备严重影响工作效
文艺复兴与宗教改革时期,具有较强群众性和普及性特点的教育是()。
ATM交换的单位是信元。在信元中使用CRC校验和来进行差错控制。CRC校验和生成公式为(288),并且,校验和只对(289)进行校验。信元交换采用的复用技术是(290)。在交换过程中,当实施VP交换时,其中VPI、VCI的变化情况是(291)。若在交换过程
Whilestillcatching-uptomeninsomespheresofmodemlife,womenappeartobewayaheadinatleastoneundesirablecategory.
最新回复
(
0
)