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

Answer: B

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.

Answer:

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

In-Memory OLTP

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)

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.

Update statistics.

Create an index on LastName.

Rebuild the index.

Answer: C

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.)

Answer:

Explanation:

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.

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.)

Answer:

Explanation:

Note:

READ UNCOMMITTED

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.

SERIALIZABLE

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?