DRAG DROP
You administer a SQL Server 2014 instance.
You have been assigned to determine the cause of frequent long-running transactions that
have been tracked to the dbo.Account table, where there are many cases of blocking and
deadlocks. The dbo.Account table contains more than one million rows.
Users and processes frequently search for and update data by using the AccountId column,
and less frequently the AccountNumber and GovernmentId columns, all of which contain
only unique values. Users frequently get lists of AccountNumber values by searching on Last
Name and then First Name.
You need to modify the structure of the dbo.Account table to alleviate the issues.
How should you complete the table definition to reduce contention on the table structure? To
answer, drag the appropriate code snippets to the correct locations in the CREATE TABLE
statement. Each code snippet may be used once, more than once, or not at all. You may
need to drag the split bar between panes or scroll to view content.
Explanation:
Note:
Users and processes frequently search for and update data by using the AccountId column
(Primary Key Clustered) , and less frequently the AccountNumber (Unique Clustered) and
GovernmentId(Unique Clustered) columns, all of which contain only unique values. Users
frequently get lists of AccountNumber values by searching on Last Name and then First
Name (LastName, Firstname) INCLUDE (AccountNumber).
CREATE TABLE dbo.Account
(
AccountNumber nchar(10) NOT NULL UNIQUE NONCLUSTERED,
Accountid int NOT NULL PRIMARY KEY CLUSTERED,
Governmentid nvarchar(11) NOT NULL UNIQUE NONCLUSTERED,
FirstName nvarchar(20) NOT NULL,
MiddleInitial nvarchar(1) NULL,
LastName nvarchar(20) NOT NULL
)
GO
CREATE NONCLUSTERED INDEX XI ON dbo.Account (FirstName, LastName) INCLUDE (AccountNumber)