首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
13
问题
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
微软认证
相关试题推荐
Climatechangeissupposedtounfoldslowly,overdecades.Butthatisnottrueupinthegreatwhitenorth,asthoseattending
Severaltypesoffinancialriskareencounteredininternationalmarketing;themajorproblemsincludecommercial,political,an
EricHansenwritesabouttravelasaparticipatingenthusiastratherthanamereobserver.【T1】Itgivesthesenineessays,based
MenorcaorMajorca?Itisthattimeoftheyearagain.Thebrochuresarepilingupintravelagentswhilenewspapersandmagazin
MenorcaorMajorca?Itisthattimeoftheyearagain.Thebrochuresarepilingupintravelagentswhilenewspapersandmagazin
Adealisadeal—except,apparently,whenEntergyisinvolved.Thecompany,amajorenergysupplierinNewEngland,provokedjus
Adealisadeal—except,apparently,whenEntergyisinvolved.Thecompany,amajorenergysupplierinNewEngland,provokedjus
Notlongago,chiefexecutiveofficers(CEOS)werelandedasheroes,leadersofthebraveneweconomy.BillGatesandJackWelchw
NextmonthBritonswillhaveyetmoresmartphonestochoosefrom,whendevicesfromWiko,atwo-year-oldFrenchcompany,goons
随机试题
A.天门冬B.麦门冬C.乌梅D.沙参E.石斛
甲、乙、丙三人射击的命中率分别为0.5,0.6,0.7,则三人都未命中的概率为()
男,71岁,排尿困难伴尿急、尿痛3年,近1个月尿滴沥,夜尿7~8次。查体:下腹部叩诊浊音;右腹股沟区见可回纳性包块,首先应进行的检查是
据统计,我国城市人群前五位死因,1957年依此为:呼吸系统疾病、传染病、消化系统疾病、心脏病、脑血管病。到1985年前五位死因顺位变为:心脏病、脑血管病、恶性肿瘤、呼吸系统疾病、消化系统疾病。根据社会医学理论,针对这些变化,下列描述不恰当的是
锅炉受热面施工中直立式组合方式的缺点是()。
根据企业所得税法律制度的规定,企业发生的下列税金中,在计算企业所得税应纳税所得额时可以扣除的有()。
根据下列图文回答问题。2004年某省种植业结构继续调整,粮食作物的种植面积占农作物种植总面积比例由上年的60.2%调整为58.4%,今年粮食作物种植面积147.11万公顷,比去年减少9.0万公顷,粮食总产量713.16万吨,其中春、夏、秋粮的产量所占比例
“四个全面”战略布局是我们党站在新的历史起点上,总结我国发展实践,适应新的发展要求,坚持和发展中国特色社会主义新探索新实践的重要成果。在新的“四个全面”战略布局中,具有突破性和先导性的关键环节是()
[*]
Whatisthespeakermainlydiscussing?
最新回复
(
0
)