Download Microsoft.70-761.PracticeTest.2019-02-03.111q.vcex

Download Exam

File Info

Exam Querying Data with Transact-SQL
Number 70-761
File Name Microsoft.70-761.PracticeTest.2019-02-03.111q.vcex
Size 13 MB
Posted Feb 03, 2019
Download Microsoft.70-761.PracticeTest.2019-02-03.111q.vcex

How to open VCEX & EXAM Files?

Files with VCEX & EXAM extensions can be opened by ProfExam Simulator.

Purchase

Coupon: MASTEREXAM
With discount: 20%






Demo Questions

Question 1

You need to create an indexed view that requires logic statements to manipulate the data that the view displays. 
Which two database objects should you use? Each correct answer presents a complete solution.


  1. a user-defined table-valued function
  2. a CRL function
  3. a stored procedure
  4. a user-defined scalar function
Correct answer: AC
Explanation:
You can create a database object inside an instance of SQL Server that is programmed in an assembly created in the Microsoft .NET Framework common language runtime (CLR). Database objects that can leverage the rich programming model provided by the common language runtime include aggregate functions, functions, stored procedures, triggers, and types.
You can create a database object inside an instance of SQL Server that is programmed in an assembly created in the Microsoft .NET Framework common language runtime (CLR). Database objects that can leverage the rich programming model provided by the common language runtime include aggregate functions, functions, stored procedures, triggers, and types.



Question 2

You have a database that includes the tables shown in the exhibit. 
  
You need to create a list of all customers, the order ID for the last order that the customer placed, and the date that the order was placed. For customers who have not placed orders, you must substitute a zero for the order ID and 01/01/1990 for the date. 
Which Transact-SQL statement should you run?


  1.   
  2.   
  3.   
  4.   
Correct answer: A
Explanation:
ISNULL Syntax: ISNULL ( check_expression , replacement_value ) author:"Luxemburg, Rosa"The ISNULL function replaces NULL with the specified replacement value. The value of check_expression is returned if it is not NULL; otherwise, replacement_value is returned after it is implicitly converted to the type of check_expression. References: https://msdn.microsoft.com/en-us/library/ms184325.aspx
ISNULL Syntax: ISNULL ( check_expression , replacement_value ) author:"Luxemburg, Rosa"
The ISNULL function replaces NULL with the specified replacement value. The value of check_expression is returned if it is not NULL; otherwise, replacement_value is returned after it is implicitly converted to the type of check_expression. 
References: https://msdn.microsoft.com/en-us/library/ms184325.aspx



Question 3

You have a database that contains the following tables:
Customer 
  
CustomerAudit 
  
Where the value of the CustomerID column equals 3, you need to update the value of the CreditLimit column to 1000 for the customer. You must ensure that the change to the record in the Customer table is recorded on the CustomerAudit table. 
Which Transact-SQL statement should you run?


  1.   
  2.   
  3.   
  4.   
  5. Option A
  6. Option B
  7. Option C
  8. Option D
Correct answer: D
Explanation:
The OUTPUT Clause returns information from, or expressions based on, each row affected by an INSERT, UPDATE, DELETE, or MERGE statement. These results can be returned to the processing application for use in such things as confirmation messages, archiving, and other such application requirements. The results can also be inserted into a table or table variable. Additionally, you can capture the results of an OUTPUT clause in a nested INSERT, UPDATE, DELETE, or MERGE statement, and insert those results into a target table or view. Note: If the column modified by the .RITE clause is referenced in an OUTPUT clause, the complete value of the column, either the before image in deleted.column_name or the after image in inserted.column_name, is returned to the specified column in the tablevariable.Incorrect Answers:C: The deleted.Creditlimit should be inserted in the second column, the OldCreditLimit column, not the third column.References: https://msdn.microsoft.com/en-us/library/ms177564.aspx
The OUTPUT Clause returns information from, or expressions based on, each row affected by an INSERT, UPDATE, DELETE, or MERGE statement. These results can be returned to the processing application for use in such things as confirmation messages, archiving, and other such application requirements. The results can also be inserted into a table or table variable. Additionally, you can capture the results of an OUTPUT clause in a nested INSERT, UPDATE, DELETE, or MERGE statement, and insert those results into a target table or view. 
Note: If the column modified by the .RITE clause is referenced in an OUTPUT clause, the complete value of the column, either the before image in deleted.column_name or the after image in inserted.column_name, is returned to the specified column in the tablevariable.
Incorrect Answers:
C: The deleted.Creditlimit should be inserted in the second column, the OldCreditLimit column, not the third column.
References: https://msdn.microsoft.com/en-us/library/ms177564.aspx



Question 4

Note: This question is part of a series of questions that use the same scenario. For your convenience, the scenario is repeated in each question. Each question presents a different goal and answer choices, but the text of the scenario is exactly the same in each question on this series.
You have a database that tracks orders and deliveries for customers in North America. System versioning is enabled for all tables. The database contains the Sales.Customers, Application.Cities, and Sales.CustomerCategories tables. 
Details for the Sales.Customers table are shown in the following table:
  
Details for the Application.Cities table are shown in the following table:
  
Details for the Sales.CustomerCategories table are shown in the following table:
  
You need to create a query that meets the following requirements:
  • For customers that are not on a credit hold, return the CustomerID and the latest recorded population for the delivery city that is associated with the customer. 
  • For customers that are on a credit hold, return the CustomerID and the latest recorded population for the postal city that is associated with the customer. 
Which two Transact-SQL queries will achieve the goal? Each correct answer presents a complete solution.


  1.   
  2.   
  3.   
  4.   
Correct answer: A
Explanation:
Using Cross Joins A cross join that does not have a WHERE clause produces the Cartesian product of the tables involved in the join. The size of a Cartesian product result set is the number of rows in the first table multiplied by the number of rows in the second table. However, if a WHERE clause is added, the cross join behaves as an inner join. B: You can use the IIF in the ON-statement.IIF returns one of two values, depending on whether the Boolean expression evaluates to true or false in SQL Server. References:https://technet.microsoft.com/en-us/library/ms190690(v=sql.105).aspxhttps://msdn.microsoft.com/en-us/library/hh213574.aspx
Using Cross Joins 
A cross join that does not have a WHERE clause produces the Cartesian product of the tables involved in the join. The size of a Cartesian product result set is the number of rows in the first table multiplied by the number of rows in the second table. 
However, if a WHERE clause is added, the cross join behaves as an inner join. 
B: You can use the IIF in the ON-statement.
IIF returns one of two values, depending on whether the Boolean expression evaluates to true or false in SQL Server. 
References:
https://technet.microsoft.com/en-us/library/ms190690(v=sql.105).aspx
https://msdn.microsoft.com/en-us/library/hh213574.aspx



Question 5

Note: This question is part of a series of questions that use the same scenario. For your convenience, the scenario is repeated in each question. Each question presents a different goal and answer choices, but the text of the scenario is exactly the same in each question on this series.
You have a database that tracks orders and deliveries for customers in North America. System versioning is enabled for all tables. The database contains the Sales.Customers, Application.Cities, and Sales.CustomerCategories tables. 
Details for the Sales.Customers table are shown in the following table:
  
Details for the Application.Cities table are shown in the following table:
  
Details for the Sales.CustomerCategories table are shown in the following table:
  
You discover an application bug that impacts customer data for records created on or after January 1, 2014. In order to fix the data impacted by the bug, application programmers require a report that contains customer data as it existed on December 31, 2013. 
You need to provide the query for the report. 
Which Transact-SQL statement should you use?


  1.   
  2.   
  3.   
  4.   
  5.   
Correct answer: D
Explanation:
The datetime datetype defines a date that is combined with a time of day with fractional seconds that is based on a 24-hour clock. The DATEFROMPARTS function returns a date value for the specified year, month, and day. Incorrect Answers:A: ValidFrom should be less (<) than @sdate AND ValidTo should be greater (>) than @edate.B: We should add a day with DATEADD, not subtract one day.C: We cannot compare a date to an exact datetime.References: https://msdn.microsoft.com/en-us/library/ms187819.aspx
The datetime datetype defines a date that is combined with a time of day with fractional seconds that is based on a 24-hour clock. 
The DATEFROMPARTS function returns a date value for the specified year, month, and day. 
Incorrect Answers:
A: ValidFrom should be less (<) than @sdate AND ValidTo should be greater (>) than @edate.
B: We should add a day with DATEADD, not subtract one day.
C: We cannot compare a date to an exact datetime.
References: https://msdn.microsoft.com/en-us/library/ms187819.aspx



Question 6

Note: This question is part of a series of questions that use the same or similar answer choices. An answer choice may be correct for more than one question in the series. Each question is independent of the other questions in this series. Information and details provided in a question apply only to that question.
You have a table named Products that contains information about the products that your company sells. The table contains many columns that do not always contain values. 
You need to implement an ANSI standard method to convert the NULL values in the query output to the phrase “Not Applicable”. 
What should you implement?


  1. the COALESCE function
  2. a view
  3. a table-valued function
  4. the TRY_PARSE function
  5. a stored procedure
  6. the ISNULL function
  7. a scalar function
  8. the TRY_CONVERT function
Correct answer: F
Explanation:
The ISNULL function replaces NULL with the specified replacement value. References: https://msdn.microsoft.com/en-us/library/ms184325.aspx
The ISNULL function replaces NULL with the specified replacement value. 
References: https://msdn.microsoft.com/en-us/library/ms184325.aspx



Question 7

Note: This question is part of a series of questions that use the same or similar answer choices. An answer choice may be correct for more than one question in the series. Each question is independent of the other questions in this series. Information and details provided in a question apply only to that question.
You have a database that is denormalized. Users make frequent changes to data in a primary table. 
You need to ensure that users cannot change the tables directly, and that changes made to the primary table also update any related tables. 
What should you implement?


  1. the COALESCE function
  2. a view
  3. a table-valued function
  4. the TRY_PARSE function
  5. a stored procedure
  6. the ISNULL function
  7. a scalar function
  8. the TRY_CONVERT function
Correct answer: B
Explanation:
Using an Indexed View would allow you to keep your base data in properly normalized tables and maintain data-integrity while giving you the denormalized "view" of that data. References: http://stackoverflow.com/questions/4789091/updating-redundant-denormalized-data-automatically-in-sql-server
Using an Indexed View would allow you to keep your base data in properly normalized tables and maintain data-integrity while giving you the denormalized "view" of that data. 
References: http://stackoverflow.com/questions/4789091/updating-redundant-denormalized-data-automatically-in-sql-server



Question 8

Note: This question is part of a series of questions that use the same or similar answer choices. An answer choice may be correct for more than one question in the series. Each question is independent of the other questions in this series. Information and details provided in a question apply only to that question.
You have a database that stores sales and order information. 
Users must be able to extract information from the tables on an ad hoc basis. They must also be able to reference the extracted information as a single table. 
You need to implement a solution that allows users to retrieve the data required, based on variables defined at the time of the query. 
What should you implement?


  1. the COALESCE function
  2. a view
  3. a table-valued function
  4. the TRY_PARSE function
  5. a stored procedure
  6. the ISNULL function
  7. a scalar function
  8. the TRY_CONVERT function
Correct answer: C
Explanation:
User-defined functions that return a table data type can be powerful alternatives to views. These functions are referred to as table-valued functions. A table-valued user-defined function can be used where table or view expressions are allowed in Transact-SQL queries. While views are limited to a single SELECT statement, user-defined functions can contain additional statements that allow more powerful logic than is possible in views. A table-valued user-defined function can also replace stored procedures that return a single result set. References: https://technet.microsoft.com/en-us/library/ms191165(v=sql.105).aspx
User-defined functions that return a table data type can be powerful alternatives to views. These functions are referred to as table-valued functions. A table-valued user-defined function can be used where table or view expressions are allowed in Transact-SQL queries. While views are limited to a single SELECT statement, user-defined functions can contain additional statements that allow more powerful logic than is possible in views. 
A table-valued user-defined function can also replace stored procedures that return a single result set. 
References: https://technet.microsoft.com/en-us/library/ms191165(v=sql.105).aspx



Question 9

Note: This question is part of a series of questions that use the same or similar answer choices. An answer choice may be correct for more than one question in the series. Each question is independent of the other questions in this series. Information and details provided in a question apply only to that question.
You have a table named AuditTrail that tracks modifications to data in other tables. The AuditTrail table is updated by many processes. Data input into AuditTrail may contain improperly formatted date time values. You implement a process that retrieves data from the various columns in AuditTrail, but sometimes the process throws an error when it is unable to convert the data into valid date time values. 
You need to convert the data into a valid date time value using the en-US format culture code. If the conversion fails, a null value must be returned in the column output. The conversion process must not throw an error. 
What should you implement?


  1. the COALESCE function
  2. a view
  3. a table-valued function
  4. the TRY_PARSE function
  5. a stored procedure
  6. the ISNULL function
  7. a scalar function
  8. the TRY_CONVERT function
Correct answer: H
Explanation:
A TRY_CONVERT function returns a value cast to the specified data type if the cast succeeds; otherwise, returns null. References: https://msdn.microsoft.com/en-us/library/hh230993.aspx
A TRY_CONVERT function returns a value cast to the specified data type if the cast succeeds; otherwise, returns null. 
References: https://msdn.microsoft.com/en-us/library/hh230993.aspx



Question 10

You have a database that stored information about servers and application errors. The database contains the following tables. 
Servers 
  
Errors 
  
You need to return all error log messages and the server where the error occurs most often. 
Which Transact-SQL statement should you run?


  1.   
  2.   
  3.   
  4.   
Correct answer: C









CONNECT US

Facebook

Twitter

PROFEXAM WITH A 20% DISCOUNT

You can buy ProfExam with a 20% discount!



HOW TO OPEN VCEX FILES

Use ProfExam Simulator to open VCEX files