PrepAway - Latest Free Exam Questions & Answers

Author: seenagape

Which Transact-SQL statement should you use?

You develop a Microsoft SQL Server 2012 server database that supports an application. The application
contains a table that has the following definition:
CREATE TABLE Inventory (
ItemID int NOT NULL PRIMARY KEY,
ItemsInStore int NOT NULL,
ItemsInWarehouse int NOT NULL)
You need to create a computed column that returns the sum total of the ItemsInStore and ItemsInWarehouse
values for each row. The new column is expected to be queried heavily, and you need to be able to index the
column. Which Transact-SQL statement should you use?

Which Transact-SQL statement should you use?

You develop a Microsoft SQL Server 2012 database that has two tables named SavingAccounts and
LoanAccounts. Both tables have a column named AccountNumber of the nvarchar data type. You use a third
table named Transactions that has columns named TransactionId AccountNumber, Amount, and
TransactionDate. You need to ensure that when multiple records are inserted in the Transactions table,only the
records that have a valid AccountNumber in the SavingAccounts or LoanAccounts are inserted. Which
Transact-SQL statement should you use?

You need to ensure that users can update only the phone numbers and email addresses by using this view

You have three tables that contain data for dentists, psychiatrists, and physicians. You create a viewthat is
used to look up their email addresses and phone numbers. The view has the following definition:

You need to ensure that users can update only the phone numbers and email addresses by using this view.
What should you do?

Which SELECT statement should you use?

You have a database that contains the tables as shown below:

You have a stored procedure named Procedure1. Procedure1 retrieves all order ids after a specific date. The
rows for Procedure1 are not sorted. Procedure1 has a single parameter named Parameter1. Parameter1 uses
the varchar type and is configured to pass the specific date to Procedure1. A database administrator discovers
that OrderDate is not being compared correctly to Parameter1 after the data type of the column is changed to
datetime. You need to update the SELECT statement to meet the following requirements:
The code must NOT use aliases.
The code must NOT use object delimiters.
The objects called in Procedure1 must be able to beresolved by all users.
OrderDate must be compared to Parameter1 after the data type of Parameter1 is changed to datetime.
Which SELECT statement should you use?
To answer, type the correct code in the answer area.

Which code segment should you use?

You have a database that contains the tables shown in the exhibit. (Refer to the Exhibit.)

You have an application named Appl. You have a parameter named @Count that uses the int data type. App1
is configured to pass @Count to a stored procedure.You need to create a stored procedure named
usp_Customers for Appl. Usp_Customers must meet thefollowing requirements:
NOT use object delimiters.
Minimize sorting and counting.
Return only the last name of each customer in alphabetical order.
Return only the number of rows specified by the @Count parameter.
The solution must NOT use BEGIN and END statements.
Which code segment should you use?
To answer, type the correct code in the answer area.