首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
18
问题
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 parts are shipped, a table named PartsShipped is updated. When Parts are received, a table names 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 those calculations that calculates current inventory by running aggregate queries on the PartsShipped and PartsReceived tables.
C、Use a view that creates an InStock as a part of an aggregate query.
D、Create stored procedures for modifying the PartsReceived and the PartsShipped tables that also modify the InStock fielding the parts table. Use these procedures exclusively when modifying data in the PartsReceived and the PartsShipped tables.
答案
A
解析
Explanation: 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 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 would not be able to detect changes in any of the columns.
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 simple update of the InStock column, and not a stored procedure, is required when changes are made to the PartsShipped and PartsReceived tables. This can be accomplished through the use of triggers.
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/8uhZ777K
本试题收录于:
微软70228题库微软认证分类
0
微软70228
微软认证
相关试题推荐
Ofallthegoodsandservicestradedinthemarketeconomy,pharmaceuticalsareperhapsthemostcontentious.Thoughproducedby
School-agechildrenshouldparticipatein60minutesormoreofmoderatetovigorousphysicalactivitydaily,accordingtoanex
Writeanessayof160-200wordsbasedonthefollowingtable.Youressayshould1.describethechangesintheaveragefamilyex
Supposeyouorderedahairdryeronlineatthecostof$22,butonlyreceivedanemptypackagebox.Somethingmustbewrong.Wri
MenorcaorMajorca?Itisthattimeoftheyearagain.Thebrochuresarepilingupintravelagentswhilenewspapersandmagazin
MireilleGuiliano,achampagnecompanyexecutive,capturedtheattentionoffrustrateddieterswithherjoyoflifeinthe2005
DrRichardBergland,abrainresearcherattheHarvardMedicalSchool,haswrittenapapersuggestingthathumanbrainisbasica
Itstartedsmall.Justapoliticalslogan,pastedontoaposterinabackofficesomewhere;NOEUROin1999.Germany’smainoppo
Thehumanbraincontains10thousandmillioncellsandeachofthesemayhaveathousandconnections.Suchenormousnumbersused
InParagraphs1and2,thetextshowsPTK’s______.Skepticalobserversbelievethatancestrytestingfailsto______.
随机试题
甲企业本年度资金平均占用额为3500万元,经分析,其中不合理部分为500万元。预计下年度销售增长5%,资金周转加速2%,则下年度资金需要量预计为()万元。
下列哪一个不是卫生行业建设存在的问题
根据《建设工程质量管理条例》的规定,将违法分包的情形界定为()。
海关对企业实施分类管理,其目的是便利企业合法进出口,促进企业的守法自律。()
下列理财工具最适合于退休养老规划的是()。
长期股权投资采用成本法核算的,应按被投资单位宣告发放的现金股利或利润中属于本企业的部分,借记“应收股利”科目,贷记“投资收益”科目;属于被投资单位在本企业取得投资前实现净利润的分配额,应该借记“应收股利”科目,贷记“资本公积”科目。()
某项工作,甲单独做需10天完成,乙单独做需6天完成。如果甲先做2天,然后乙接替甲做2天,再由甲接替乙做2天……两人如此交替工作。那么,完成此项工作共用多少天?
AnearthquakehitKashmironOct.8,2005.Ittooksome75000lives,【C1】______130000andleftnearly3.5millionwithoutfood
若要求在文本框中输入文本时达到密码“。”号的显示效果,则应设置的属性是()。
ReturningtoScienceTeresaGarrettwasworkingpart-timeasabiochemistrypostdoc(博士后).Shehadaninfantathome,andsh
最新回复
(
0
)