首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
You are the administrator of a SQL Server 2000 computer. The server contains a database named Inventory. The database has a Part
You are the administrator of a SQL Server 2000 computer. The server contains a database named Inventory. The database has a Part
admin
2009-05-19
27
问题
You are the administrator of a SQL Server 2000 computer. The server contains a database named Inventory. The database has a Parts table that has a field named InStock.
When the parts have shipped, a table named PartsShipped is updated. When the parts are received, a table named PartsReceived is updated. The relationship of these tables is shown in the exhibit.
You want the database to update the InStock field automatically. What should you do?
选项
A、Add triggers to the PartsShipped and the PartsReceived tables that update the InStock field in the Parts table.
B、Create a user-defined function that calculates current inventory by running aggregate queries on the PartsShipped and PartsReceived tables.
C、Use a view that creates an InStock field as part of an aggregate query.
D、Create stored procedures for modifying the PartsShipped and PartsReceived tables that also modify the InStock field in the Parts table. Use these procedures exclusively when modifying data in the PartsShipped and PartsReceived tables.
答案
A
解析
Explanation: The Instock column of the Parts table must be updated when records are changed in the other two tables PartsReceived and PartsShipped. The only way to accomplish this is to use triggers on the PartsReceived and PartsShipped tables.
Note: Triggers are a special class of stored procedure defined to fire automatically when an UPDATE, INSERT, or DELETE statement is issued against a table or view. They are powerful tools that can be used to enforce business rules automatically when data is modified. Triggers can extend the integrity checking logic of SQL Server constraints, defaults, and rules, although constraints and defaults should be used instead whenever they provide all the needed functionality. In this scenario an AFTER UPDATE trigger can be used to update the tables to update the PartsShipped and the PartsReceived tables that update the InStock column in the parts table.
Incorrect Answers:
B: A function cannot, by itself, be used to update the contents of one table when changes are made to another table.
Note: A user-defined function is a subroutine that is made up of one or more Transact-SQL statements and can be used to encapsulate code for reuse. It can be used to run aggregate calculations. However, a simple update of the InStock column, and not a aggregate function, is required when changes are made to the PartsShipped and PartsReceived tables. This can be accomplished through the use of triggers.
C: A view cannot be used to update the contents of one table when changes are made to another table.
Note: A view is a virtual table that allows data to be accessible through it rather than through the base table. A view can be referenced through Transact-SQL statements in the same way a table is. In addition a table can be used to restrict a user to specific rows and/or columns in a table, join columns from multiple tables so that they appear as a single virtual table and can aggregate information instead of supplying details to the user.
D: A function cannot, by itself, be used to update the contents of one table when changes are made to another table.
Note: A stored procedure is a group of Transact-SQL statements compiled into a single execution plan. Stored procedures can return data as output parameters; return codes; a result set for each SELECT statement contained in the stored procedure or any other stored procedures called by the stored procedure; or a global cursor that can be referenced outside the stored procedure. Stored procedures assist in achieving a consistent implementation of logic across applications and can improve performance.
转载请注明原文地址:https://kaotiyun.com/show/buhZ777K
本试题收录于:
微软70228题库微软认证分类
0
微软70228
微软认证
相关试题推荐
Ofallthegoodsandservicestradedinthemarketeconomy,pharmaceuticalsareperhapsthemostcontentious.Thoughproducedby
Evenbeforetheopeningceremony,arecordhadbeenbrokenatSochi:12newevents,themostforanyOlympics,werescheduledto
[A]Enduringproblemssuchaswar,poverty,andviolenceultimatelyspringfromhumannature,whichnotechnologicalinnovation
Youliveinaroomincollegewhichyousharewithanotherstudent.Youfinditverydifficulttoworktherebecauseyourroomma
YouarepreparingforanEnglishtestandhaveorderedareferencebookfromabookstore.Afteryoureadthebook,youfoundtha
SupposeyouphonedyourfriendMaryseveraltimesyesterdaybutshedidn’tansweryourcallatall.Writeheranemailto1
Supposeyouhavefoundsomethingwrongwiththebookthatyouboughtfromanonlinestoretheotherday.Writeane-mailtothe
Notlongago,chiefexecutiveofficers(CEOS)werelandedasheroes,leadersofthebraveneweconomy.BillGatesandJackWelchw
InToday’smanagement-theoryindustry,reputation—oratleastthecorporatekind—isa"strategicasset"thatcanbe"leveraged"
Faceit,moviefans:theDVDisdestinedtobedeadasadoornail.OnlyafewBlockbusterstoresarestillopen.Netflix’s(o
随机试题
课外校外教育是指——以外,对学生实施的有计划、有目的、有组织的教育活动。()
对于新建的城市生活垃圾填埋场,为确定渗滤液中污染物通过填埋场底部垂直向下迁移到达含水层的时间,需要确定渗滤液()。
为了达到蛋白质每日75g的推荐摄入量,老年人每天应摄入充足的猪肉。()
出错是学生学习过程中的常见想象,如何应对学生的差错,特级教师华应龙提出了“融错教育”,容错、融错、荣错。容错是容许出错,善待差错。融错是分析差错背后的原因,让差错成为教学资源,变废为宝。荣错是指一人出错可能全班受益,正确的解答可能只是模仿,而错误的解答可能
李时珍
求x[1+yf(x2+y2)]dxdy,其中D是由y=x3,y=1,x=一1所围成的区域,f(x,y)是连续函数.
有两个关系R和S如下图所示:则由关系R得到关系S的运算是
Questions29-40•Readtheintroductionbelowaboutacompanytrainingprogramme.•Choosethecorrectwordtofilleachg
A、Consultotherinsurancecompanies.B、Buythestudenthealthinsurance.C、Gettheinternationaltravelinsurance.D、Chooseneit
AdetailedandthoroughresearchprojectundertakenbytheOpenUniversityrecentlyreportedthattheirevidenceappearstoshow
最新回复
(
0
)