Uploaded on Aug 2, 2019
Realexamdumps is offering 70-461 exam dumps for the preparation of IT exams. You can easily download this stuff with free demo questions. It is expertly written and verified study material so you can ace your certification by the first attempt. Now you can meet your guaranteed success by following the directions of the experts. 70-461 dumps material is to-the-point and briefly describe each syllabus topic in the form of questions and answers. for more info:https://real-exam-questions-answers.blogspot.com/2019/07/download-70-461-dumps-quickly-and-have.html
2019 Up to Date Microsoft 70-461 Dumps PDF with 100% Passing Guarantee
Microsoft 70-461 Exam Dumps
Querying Microsoft SQL Server 2012
For More Info
https://real-exam-questions-answers.blogspot.com/2019/07/download-70-461-dumps-quickly-and-have.html
Question: 1
You use a Microsoft SQL Server database that contains a table. The table has records of web requests as
shown in the exhibit. (Click the Exhibit button.)
Your network has three web servers that have the following IP addresses:
10.0.0.1
10.0.0.2
10.0.0.3
You need to create a query that displays the following information:
The number of requests for each web page (UriStem) grouped by the web server (ServerIP) that served
the request
A column for each server
Which Transact-SQL query should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: A
Explanation:
PIVOT rotates a table-valued expression by turning the unique values from one column in the expression
into multiple columns in the output, and performs aggregations where they are required on any
remaining column values that are wanted in the final output.
References: https://docs.microsoft.com/en-us/sql/t-sql/queries/from-using-pivot-and-
unpivot?view=sql-server-2017
Question: 2
DRAG DROP
You develop a Microsoft SQL Server database for a sales ordering application.
You want to create a report that displays the increase of order quantities over the previous year for each
product.
You need to write a query that displays:
Product name,
Year of sales order,
Sales order quantity, and
Increase of order quantity over the previous year.
Which three Transact-SQL segments should you use to develop the solution? To answer, move the
appropriate Transact-SQL segments from the list of Transact-SQL segments to the answer area and
arrange them in the correct order.
Answer:
Box 1: FROM ..
Box 2: LAG (not LEAD)
Lag accesses data from a previous row in the same result set without the use of a self-join starting with
SQL Server 2012 (11.x). LAG provides access to a row at a given physical offset that comes before the
current row. Use this analytic function in a SELECT statement to compare values in the current row with
values in a previous row.
Not lead: Lead accesses data from a subsequent row in the same result set without the use of a self-join
starting with SQL Server 2012 (11.x). LEAD provides access to a row at a given physical offset that
follows the current row.
Box 3: GROY BY PRO.NAME, YEAR (OrderDate)
References: https://docs.microsoft.com/en-us/sql/t-sql/functions/lag-transact-sql?view=sql-server-2017
Question: 3
You develop a Microsoft SQL Server database that contains a table named Employee, defined as follows:
You need to create a view that contains two computed columns representing the month and the year of
the [HireDate] of each Employee.
Which function should you use?
A. DATENAME( )
B. CONVERT( )
C. TRYDATEDIFF( )
D. MONTH( ) and YEAR( )
Answer: D
Explanation:
The Month function returns an integer that represents the month of the specified date.
The Year function an integer that represents the year of the specified date.
References:
https://docs.microsoft.com/en-us/sql/t-sql/functions/month-transact-sql?view=sql-server-2017
https://docs.microsoft.com/en-us/sql/t-sql/functions/year-transact-sql?view=sql-server-2017
Question: 4
You administer a Microsoft SQL Server database named ContosoDb. The database has the following
schema collection:
The database has a table named ReceivedPurchaseOrders that includes an XML column named
PurchaseOrder by using the above schema.
You need to set the requiresApproval attribute of the XML documents to false if they contain more than
50 items.
Which Transact-SQL query should you run?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: D
Explanation:
Replace value of (XML DML) updates the value of a node in the document.
Example: -- update text in the first manufacturing step
SET @myDoc.modify('
replace value of (/Root/Location/step[1]/text())[1]
with "new text describing the manu step"
');
Question: 5
DRAG DROP
Your Microsoft SQL Server database contains tables as shown below.
You have tables that were created by running the following Transact-SQL statements:
The Product table contains 10,000 records. The maximum ProductID is 11,000.
There are 12 rows in the Category table. The maximum CategoryID is 12.
The Product table contains at least one product in every category.
Data in the tables was accidently modified. To correct this, you need to make some updates directly to
the tables. You issue several statements.
Which result or results will you obtain for each Transact-SQL statement? To answer, drag the
appropriate results to the correct Transact-SQL statements. Each result 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.
Answer:
Box 1:
The SET IDENTITY_INSERT command allows explicit values to be inserted into the identity column of a
table.
Box 2:
The Product table contains at least one product in every category.
Box 3:
Box 4:
Bit is a data type that can take a value of 1, 0, or NULL.
References:
https://docs.microsoft.com/en-us/sql/t-sql/data-types/bit-transact-sql?view=sql-server-2017
https://docs.microsoft.com/en-us/sql/t-sql/statements/set-identity-insert-transact-sql?view=sql-server-
2017
Question: 6
DRAG DROP
You develop an application that uses data from a Microsoft SQL Server database.
Your application experiences blocking problems.
You need to enable row versioning and you want connections to have row versioning enabled by
default.
How should you complete the Transact-SQL statement? To answer, drag the appropriate command to
the correct positions. Each command 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.
Answer:
You can use a row versioning-based isolation level.
Set READ_COMMITTED_SNAPSHOT database option ON to enable read-committed transactions to use
row versioning, and use snapshot isolation.
References: https://docs.microsoft.com/en-us/sql/relational-databases/sql-server-transaction-locking-
and-row-versioning-guide?view=sql-server-2017
Question: 7
DRAG DROP
You are a developer for a Microsoft SQL Server database. You need to write a stored procedure that
performs several operations in the most efficient way possible.
Which operator or operators should you use? To answer, drag the appropriate operators to the correct
operations. Each operator 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.
Answer:
Box 1: UNION ALL
UNION combines the results of two or more queries into a single result set that includes all the rows
that belong to all queries in the union.
UNION ALL Incorporates all rows into the results. This includes duplicates. If ALL is not specified,
duplicate rows are removed.
Box 2: INTERSECT
INTERSECT returns distinct rows that are output by both the left and right input queries operator.
Box 3: INNER JOIN
The INNER JOIN keyword selects records that have matching values in both tables.
Box 4: MERGE
Merge performs insert, update, or delete operations on a target table based on the results of a join with
a source table. For example, you can synchronize two tables by inserting, updating, or deleting rows in
one table based on differences found in the other table.
Box 5: FULL OUTER JOIN
The FULL OUTER JOIN keyword return all records when there is a match in either left (table1) or right
(table2) table records.
Note: FULL OUTER JOIN can potentially return very large result-sets!
Question: 8
You develop a database application for Microsoft SQL Server and Microsoft Azure SQL Database.
You need to raise an exception and transfer execution to a CATCH block.
You need to ensure that the exception returns output in the following format:
Msg 51000, Level 16, State 1, Line 1
The record does not exist.
Which Transact-SQL statement should you run?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: B
Explanation:
The following example shows how to use the THROW statement to raise an exception.
THROW 51000, 'The record does not exist.', 1;
Here is the result set.
Msg 51000, Level 16, State 1, Line 1
The record does not exist.
References: https://docs.microsoft.com/en-us/sql/t-sql/language-elements/throw-transact-
sql?view=sql-server-2017
Question: 9
DRAG DROP
You develop a database application for Microsoft SQL Server 2012 and Microsoft Azure SQL Database.
You create a table named Purchasing.vVendorWithAddresses as shown in the following table.
You write the following Transact-SQL (Line numbers are included for reference only.)
01 CREATE PROCEDURE
You need to add Transact-SQL statements at line 08 to ensure that GetVendorInStateNeighbors returns
the names of vendors that are located in all states where the vendor specified in the @vendorname
parameter has a location.
Which three Transact-SQL segments should you use to develop the solution? To answer, move the
appropriate Transact-SQL segments from the list of Transact-SQL segments to the answer area and
arrange them in the correct order.
Answer:
The IN statement determines whether a specified value matches any value in a subquery or a list.
Incorrect:
The EXISTS command specifies a subquery to test for the existence of rows.
References: https://docs.microsoft.com/en-us/sql/t-sql/language-elements/in-transact-sql?view=sql-
server-2017
Question: 10
A local bank uses a SQL Server database to manage accounts. You are developing a stored procedure
that contains multiple Transact-SQL INSERT statements.
The stored procedure must use transaction management to handle errors.
You need to ensure that the stored procedure rolls back the entire transaction if a run-time occurs.
Which Transact-SQL statement should you add to the stored procedure?
A. SET ARITHABORT ON
B. SET NOEXEC ON
C. SET TRANSACTION ISOLATION LEVEL ON
D. SET XACT_ABORT ON
Answer: D
Explanation:
SET XACT_ABORT specifies whether SQL Server automatically rolls back the current transaction when a
Transact-SQL statement raises a run-time error.
When SET XACT_ABORT is ON, if a Transact-SQL statement raises a run-time error, the entire transaction
is terminated and rolled back.
References: https://docs.microsoft.com/en-us/sql/t-sql/statements/set-xact-abort-transact-
sql?view=sql-server-2017
Question: 11
DRAG DROP
You are the administrator for a heavily-used OLTP Microsoft SQL Server database.
You are troubleshooting performance issues seen when using stored procedures in the database. The
database stores millions of orders across thousands of customers. Some of the customers have large
numbers of orders, while others have only one order. You update the statistics and perform
defragmentation of all tables and indexes, but two stored procedures still have issues when accessing
data.
p_GetCustomer accepts @companyID as a parameter. From the results of profiling, you know that 90
percent of the calls use the @companyid value of 5, while the other 10 percent of calls are evenly
distributed across another 10000 values. While viewing the execution plan, you discover that a non-
clustered index seek is used.
p_GetShipDate accepts @orderID as a parameter and returns the ship date for that order. You discover
that the execution plan is performing a scan on a non-clustered index that has orderID as the index key.
You need to add appropriate query hints to each stored procedure to improve the performance.
What should you do? To answer, drag the appropriate procedures to the correct hints. Each procedure
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.
Answer:
Box 1: Optimize FOR..
OPTIMIZE FOR ( @variable_name { UNKNOWN | = literal_constant } [ , ...n ] )
Instructs the query optimizer to use a particular value for a local variable when the query is compiled
and optimized. The value is used only during query optimization, and not during query execution.
Box 2: FORCESEEK
FORCESEEK [ (index_value(index_column_name [ ,... n ] )) ]
Specifies that the query optimizer use only an index seek operation as the access path to the data in the
table or view.
References:
https://docs.microsoft.com/en-us/sql/t-sql/queries/hints-transact-sql-query?view=sql-server-2017
https://docs.microsoft.com/en-us/sql/t-sql/queries/hints-transact-sql-table?view=sql-server-2017
Question: 12
You use Microsoft SQL Server to develop a database application.
Your application sends data to a VARCHAR(50) variable named @var.
You need to write a Transact-SQL statement that will return information on a successful or unsuccessful
cast to an integer in a table.
Which Transact-SQL statement should you run?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: B
Explanation:
TRY_PARSE returns the result of an expression, translated to the requested data type, or null if the cast
fails in SQL Server. Use TRY_PARSE only for converting from string to date/time and number types.
References: https://docs.microsoft.com/en-us/sql/t-sql/functions/try-parse-transact-sql?view=sql-
server-2017
Question: 13
DRAG DROP
You are developer for a Microsoft Azure SQL Database instance.
You are creating a new stored procedure. The procedure must perform the following tasks in this order:
1. Update a table named OrderHistory.
2. Delete rows from a table named Orders.
3. Delete rows from a table named Customers.
4. Insert rows into a table named ProcessHistory.
You need to ensure that the procedure meets the following requirements:
If either DELETE operation fails, the rest of operation must continue.
If either the UPDATE operation or the INSERT operation fails, the whole procedure should fail and no
changes should be retained.
Which four Transact-SQL segments should you use to develop the solution? To answer, move the
appropriate Transact-SQL segments from the list of Transact-SQL segments to the answer area and
arrange them in the correct order.
Answer:
When SET XACT_ABORT is ON, if a Transact-SQL statement raises a run-time error, the entire transaction
is terminated and rolled back.
When SET XACT_ABORT is OFF, in some cases only the Transact-SQL statement that raised the error is
rolled back and the transaction continues processing.
References: https://docs.microsoft.com/en-us/sql/t-sql/statements/set-xact-abort-transact-
sql?view=sql-server-2017
Question: 14
CORRECT TEXT
You have a SQL Server database that contains all of the sales data for your company.
You need to create a query that returns the customers who represent the top five percent of the total
actual sales.
Part of the correct Transact-SQL has been provided in the answer area below. Enter the code in the
answer area that resolves the problem and meets the stated goals or requirements. You can add code
within the code that has been provided as well as below it.
Use the Check Syntax button to verify your work. Any syntax or spelling errors will be reported by line
and character position.
Answer:
1 SELECT CustomerID, N
2 ,Top5= TOP (0,95) PERCENT Sales (ORDER BY N) OVER (PARTITION BY Sales)
3 FROM Customers;
Add TOP and PERCENT Sales on line 2.
Syntax:
TOP (expression) [PERCENT]
[ WITH TIES ]
]
expression
Is the numeric expression that specifies the number of rows to be returned. expression is implicitly
converted to a float value if PERCENT is specified; otherwise, it is converted to bigint.
PERCENT
Indicates that the query returns only the first expression percent of rows from the result set. Fractional
values are rounded up to the next integer value.
References: https://docs.microsoft.com/en-us/sql/t-sql/queries/top-transact-sql?view=sql-server-2017
Question: 15
CORRECT TEXT
You plan to deploy a stored procedure for a database named TICKETS.
You need to implement error handling for the stored procedure to ensure that the system-defined error
messages are returned if an error occurs upon insert.
Part of the correct Transact-SQL has been provided in the answer are below. Enter the code in the
answer area that resolves the problem and meets the stated goals or requirements. You can add code
within the code that has been provided as well as below it.
/
/
Use the ‘Check Syntax’ button to verify your work. Any syntax or spelling errors will be reported by line
and character position.
Answer:
1 CREATE PROCEDURE AdCase
2 @CustomerId INT,
3 @ProblemId INT,
4 @Comment NVARCHAR (MAX)
5 AS
6
7 BEGIN TRY
8 INSERT INTO Cases
9 (CustomerId, ProblemId, Comment)
10 VALUES
11 (@CustomerId, @ProblemId, @Comment)
12 END TRY
13 BEGIN CATCH
14 INSERT INTO AppLog
15 (CurrentTime, ErrorNumber, CustomerId)
16 VALUES
17 (getdate(), ERROR_NUMBER(), @CustomerId);
18 THROW;
19
20 END CATCH
21
Make changes and additions in the above lines.
7 BEGIN TRY
12 END TRY
13 BEGIN CATCH
18 THROW;
20 END CATCH
References:
https://docs.microsoft.com/en-us/sql/t-sql/language-elements/try-catch-transact-sql?view=sql-server-
2017
https://docs.microsoft.com/en-us/sql/t-sql/language-elements/throw-transact-sql?view=sql-server-
2017
Question: 16
Note: This question is part of a series of questions that use the same set of answer choices. An
answer choice may be correct for more than one question in the series.
You develop a database for a travel application. You create a view that displays details of events and
attractions. The names of the event and attractions are sorted alphabetically.
You need to sort the names in a case-sensitive, dictionary order.
What should you do?
A. Use the CAST function.
/
B. Use the DATE data type.
C. Use the FORMAT function.
D. Use an appropriate collation.
E. Use a user-defined table type.
F. Use the VARBINARY data type.
G. Use the DATETIME data type.
H. Use the DATETIME2 data type.
I. Use the DATETIMEOFFSET data type.
J. Use the TODATETIMEOFFSET function.
Answer: D
Explanation:
This topic describes SQL Server 2008 collation options for instances of SQL Server that require
compatibility with versions of SQL Server that do not use collations.
The following SQL collations are listed on the Collation Settings page of the SQL Server Installation
Wizard.
References: https://msdn.microsoft.com/it-it/library/ms144250(v=sql.105).aspx
Question: 17
Note: This question is part of a series of questions that use the same set of answer choices. An
answer choice may be correct for more than one question in the series.
You develop a database for a travel application. You need to design tables and other database objects.
You create the Historical_Events table.
You need to store dates by using the smallest possible storage size.
What should you do?
A. Use the CAST function.
B. Use the DATE data type.
C. Use the FORMAT function.
D. Use an appropriate collation.
/
E. Use a user-defined table type.
F. Use the VARBINARY data type.
G. Use the DATETIME data type.
H. Use the DATETIME2 data type.
I. Use the DATETIMEOFFSET data type.
J. Use the TODATETIMEOFFSET function.
Answer: B
Explanation:
The size of a column with the DATE format is 3 bytes fixed.
Incorrect Answers:
G: The DATETIME data type storage size is 8 bytes.
H: datetime2 can be considered as an extension of the existing datetime type that has a larger date
range, a larger default fractional precision, and optional user-specified precision.
I: The 26 DATETIMEOFFSET data type storage size is 10 bytes.
References: https://docs.microsoft.com/en-us/sql/t-sql/data-types/date-transact-sql?view=sql-server-
2017
Question: 18
DRAG DROP
You develop a Microsoft SQL Server Database. The database contains a table named Status that is
defined by the following Transact-SQL statement:
There are thousands of rows in the Status table, with significant duplication of data in the Color column.
Ninety percent of the rows in the table have Color="Red", and the remaining 10 percent have
Color="Green".
You want to normalize the Color information in this table. You create a table named Colors that is
defined by the following DDL:
/
You populate the new Colors table by using the following Transact-SQL statement:
INSERT Colors (ColorName) SELECT DISTINCT Color FROM Status
You need to ensure that the following requirements are met:
The Status table uses only colors that exist in the Colors table.
Data redundancy in the Status table is reduced.
Data integrity is enforced during the normalization process.
Which three Transact-SQL segments should you use to develop the solution? To answer, move the
appropriate Transact-SQL segment from the list of Transact-SQL segments to the answer area and
arrange them in the correct order.
Answer:
Explanation:
/
First update the new column ColorID, and drop the old Column Color.
Add a check constraint on the new ColorID column, and finally add a foreign key constraint.
Question: 19
DRAG DROP
You use Microsoft SQL Server client tool to develop a Microsoft Azure SQL Database instance to support
an e-commerce application. The database consists of a Product table, a Store table, and a StoreProduct
table as shown in the exhibit. (Click the Exhibit button.)
You need to write a trigger that meets the following requirements:
Stores are not physically deleted, but are marked as deleted.
When a store is deleted, the products that are sold in that store are marked as discontinued.
Which four Transact-SQL segments should you use to develop the solution? To answer, move the
appropriate Transact-SQL segments from the list of Transact-SQL segments to the answer area and
arrange them in the correct order.
Exhibit
/
Answer:
/
Question: 20
You have a database that contains the following related tables:
You create a view named OrderSummary by using the following Transact-SQL statement:
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
/
Answer:
Explanation:
The SalesOrderID column is used in a join statement and cannot be updated.
The Status column is used can be updated.
The SubTotal column is an aggregate column and cannot be updated.
Question: 21
You use a Microsoft Azure SQL DataBase instance. The instance contains a table named Customers that
has columns named Id, Name, and IsPriority.
You need to create a view named VwPriorityCustomers that:
returns rows from Customer that have a value of True in the IsPriority column, and
does not allow columns to be altered or dropped in the underlying table.
Which Transact-SQL statement shoul you run?
A. CREATE VIEW VwPriorityCustomers
AS
SELECT Id, Name FROM dbo.Customers WHERE IsPriority=1
WITH CHECK OPTION
B. CREATE VIEW VwPriorityCustomers
WITH VIEW_METADATA
AS
SELECT Id, Name FROM dbo.Customers WHERE IsPriority=1
C. CREATE VIEW VwPriorityCustomers
WITH ENCRYPTION
AS
SELECT Id, Name FROM dbo.Customers WHERE IsPriority=1
D. CREATE VIEW VwPriorityCustomers
WITH SCHEMABINDING
AS
SELECT Id, Name FROM dbo.Customers WHERE IsPriority=1
Answer: D
Explanation:
/
SCHEMABINDING binds the view to the schema of the underlying table or tables. When
SCHEMABINDING is specified, the base table or tables cannot be modified in a way that would affect the
view definition.
References: https://docs.microsoft.com/en-us/sql/t-sql/statements/create-view-transact-sql?view=sql-
server-2017
/
Comments