Developing Microsoft SQL Server 2012 Databases
Question No: 91 – (Topic 8)
You are creating a stored procedure named usp1. Usp1 will create a table that will be used during the execution of usp1. Only usp1 will be allowed to access the table.
You need to write the code required to create the table for usp1. The solution must minimize the need to recompile the stored procedure.
Which code segment should you use to create the table?
CREATE TABLE oneTable
CREATE TABLE ##oneTable
CREATE TABLE #oneTable
DECLARE oneTable TABLE
Question No: 92 DRAG DROP – (Topic 8)
You plan to create a new table that will contain a column named Salary. Salary will contain highly sensitive data.
Salary must meet the following requirements:
->Contain numeric data.
->Contain only encrypted data that remains encrypted in memory.
You need to identify which encryption type and data type must be used for Salary.
Which encryption type and data type should you identity?
To answer, drag the appropriate encryption type and data type to the correct identifier in the answer area.
Question No: 93 – (Topic 8)
You are designing a new database table that will be used for reporting. You define the table by using the following statement.
You need to store the data in the table by using the least amount of storage space possible.
Which storage option should you use?
a clustered index
a clustered columnstore index
a nonclustered index
Answer: B Explanation:
Columnstore indexes work well for mostly read-only queries that perform analysis on large data sets. This would fit this scenario as the table will be used for reporting.
Columnstore Index benefits include Columnstore Index benefits high compression rates, which improve query performance by using a smaller in-memory footprint. In turn, query performance can improve because SQL Server can perform more query and data operations in-memory.
Use the columnstore index to achieve up to 10x query performance gains over traditional row-oriented storage, and up to 7x data compression over the uncompressed data size.
Question No: 94 – (Topic 8)
You have the following query on a disk-based table:
You discover that the query takes a long time to complete.
The execution plan is shown in the Execution Plan exhibit. (Click the Exhibit button.)
The index usage is show in the Index Usage exhibit. (Click the Exhibit button.)
You need to reduce the amount of time it takes to complete the query. You must achieve this goal as quickly as possible.
What should you do?
Reorganize the index.
Create an index on LastName.
Rebuild the index.
Question No: 95 DRAG DROP – (Topic 8)
You have a database named database1. Each table in database1 has one index per column.
Users often report that creating items takes a long time. You need to perform the following maintenance tasks: What should you use?
To answer, drag the appropriate function to the correct management task in the answer area. (Answer choices may be used once, more than once, or not at all.)
Box 1: sys.dm_db_index_usage_stats
sys.dm_db_index_usage_stats shows you how many times the index was used for user queries. It returns counts of different types of index operations and the time each type of operation was last performed in SQL Server.
Box 2: sys.dm_db_missing_index_details
sys.dm_db_missing_index_details returns detailed information about a missing index; for example, it returns the name and identifier of the table where the index is missing, and the columns and column types that should make up the missing index.
References: https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic- management-views/sys-dm-db-index-usage-stats-transact-sql https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys- indexes-transact-sql
Question No: 96 – (Topic 8)
You are creating a table named Orders.
You need to ensure that every time a new row is added to the Orders table, a user-defined function is called to validate the row before the row is added to the table.
What should you use?
More than one answer choice may achieve the goal. Select the BEST answer.
A data manipulation language (DML) trigger
A DEFAULT constraint
A Data Definition Language (DDL) trigger
A CHECK constraint
A FOREIGN KEY constraint
Answer: D Explanation:
Question No: 97 – (Topic 8)
You have a Microsoft SQL Azure database that contains a table named Employees.
You create a non-clustered index named EmployeeName on the name column.
You write the following query to retrieve all of the employees that have a name that starts with the letters JOH:
You discover that the query performs a table scan.
You need to ensure that the query uses EmployeeName. What should you do?
Recreate EmployeeName as a unique index
Recreate EmployeeName as a clustered index
Replace LEFT(name,3) = #39;JOH#39; by using name like #39;JOH%#39;
Replace LEFT(name,3) = #39;JOH#39; by using substring(name, 1, 3) = #39;JOH#39;
Question No: 98 DRAG DROP – (Topic 8)
You plan to deploy two stored procedures named SP1 and SP2 that read data from the database.
Your company identifies the following requirements for each stored procedure:
->SP1 must allow dirty reads.
->SP2 must place range locks on the data to ensure read consistency.
You need to identify which isolation level you must set for each stored procedure. The solution must minimize the number of locks.
Which isolation level should you identify?
To answer, drag the appropriate isolation level to the correct stored procedure in the answer area. (Answer choices may be used once, more than once, or not at all.)
Specifies that statements can read rows that have been modified by other transactions but not yet committed.
Transactions running at the READ UNCOMMITTED level do not issue shared locks to prevent other transactions from modifying data read by the current transaction. READ UNCOMMITTED transactions are also not blocked by exclusive locks that would prevent the current transaction from reading rows that have been modified but not committed by other transactions. When this option is set, it is possible to read uncommitted modifications, which are called dirty reads. Values in the data can be changed and rows can appear or disappear in the data set before the end of the transaction. This option has the same effect as setting NOLOCK on all tables in all SELECT statements in a transaction. This is the least restrictive of the isolation levels.
Specifies the following:
Statements cannot read data that has been modified but not yet committed by other transactions.
No other transactions can modify data that has been read by the current transaction until the current transaction completes.
Other transactions cannot insert new rows with key values that would fall in the range of keys read by any statements in the current transaction until the current transaction completes.
Range locks are placed in the range of key values that match the search conditions of each
statement executed in a transaction. This blocks other transactions from updating or inserting any rows that would qualify for any of the statements executed by the current transaction. This means that if any of the statements in a transaction are executed a second time, they will read the same set of rows. The range locks are held until the transaction completes. This is the most restrictive of the isolation levels because it locks entire ranges of keys and holds the locks until the transaction completes. Because concurrency is lower, use this option only when necessary.
Question No: 99 – (Topic 8)
You have a SQL Azure database.
You need to identify which keyword must be used to create a view that will be indexed. Which keyword should you identify?
Answer: A Explanation:
Question No: 100 DRAG DROP – (Topic 8)
You execute the following code:
You discover that the Customers table was created in the dbo schema.
You need to create a code segment to move the table to another schema named Schema2.
What should you create?
To answer, drag the appropriate code segments to the correct location in the answer area. (Answer choices may be used once, more than once, or not at all.)
|Lowest Price Guarantee||Yes||No||No|
|Free VCE Simulator||Yes||No||No|