首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
35
问题
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
微软认证
相关试题推荐
Inthe1930s,anAmericanmeatcompanycameoutwithaspicedhamproductsoldinacan.Beforelong,Spam,asitwascalled,be
Directions:Inthissection,youareaskedtowriteanessaybasedonthefollowinginformation.Makecommentsandexpressy
Twomonthsago,yougotajobasaconsultantforHumanResourceServiceCompany.Butnowyoufindthattheworkisnotwhatyou
EricHansenwritesabouttravelasaparticipatingenthusiastratherthanamereobserver.【T1】Itgivesthesenineessays,based
EricHansenwritesabouttravelasaparticipatingenthusiastratherthanamereobserver.【T1】Itgivesthesenineessays,based
MireilleGuiliano,achampagnecompanyexecutive,capturedtheattentionoffrustrateddieterswithherjoyoflifeinthe2005
Adealisadeal—except,apparently,whenEntergyisinvolved.Thecompany,amajorenergysupplierinNewEngland,provokedjus
Notlongago,chiefexecutiveofficers(CEOS)werelandedasheroes,leadersofthebraveneweconomy.BillGatesandJackWelchw
设置过滤器时,应先选择database菜单中的()选项。A.setupB.browseC.appendD.copyto
随机试题
下列哪一选项中法院的审判行为,只能发生在开庭审理阶段?
血液凝固的主要步骤是
在房地产抵押贷款中,抵押权人一般为()。
某高校长期设置基建处,负责学校的基本建设工作,具有丰富的项目管理经验,有相应的项目管理能力,则该高校修建学生食堂应采取的项目管理模式是( )。
西岐公司2010年3月15日购入一台不需要安装设备并投入生产车间使用,取得的增值税专用发票上注明的设备价款50000元,增值税8500元。西岐公司采用年限平均法计提折旧,该设备预计使用10年,预计净残值率为4%,2011年3月25日,西岐公司将该设备出售给
证券公司为证券交易创造一个流动性较强的市场并维持市场价格的相对稳定,这指的是证券公司充当()的角色。
甲公司于2016年1月1日购入乙公司当日发行的3年期公司债券,作为持有至到期投资核算,在购买日其公允价值为60480万元,发生交易费用60万元。债券面值为60000万元,票面年利率为3%,半年期实际利率为1.34%,每半年付息一次,采用实际利率法摊销利
下列文中画横线语句断句正确的一项是()。延祐初,科举法行,乡贡、会试皆中第一,廷试为第二人。授应奉翰林文字。拜监察御史。是时仁宗在御已久,犹居东宫,饮酒常过度。祖常上书请:“御正衙立朝仪御史执简太史执笔则虽有怀奸利己乞官求赏者不敢出诸口……”
Onedayafarmer’sdonkeyfelldownintoawell.Theanimalcriedpiteously【K1】______hoursasthefarmertriedtofigureoutwh
HowtoGetPreservedasaFossil【M1】Unfortunatelythechangesofanyanimalbecomeafossilarenotverygreat,and【M2】the
最新回复
(
0
)