Download Querying Data with Transact-SQL.70-761.BrainDumps.2018-05-18.75q.vcex

Vendor: Microsoft
Exam Code: 70-761
Exam Name: Querying Data with Transact-SQL
Date: May 18, 2018
File Size: 16 MB

How to open VCEX files?

Files with VCEX extension can be opened by ProfExam Simulator.

ProfExam Discount

Demo Questions

Question 1
You have a database that includes the following tables:
   
You need to create a list of all customer IDs and the date of the last order that each customer placed. If the customer has not placed any orders, you must return the date January 1, 1900. The column names must be CustomerID and LastOrderDate. 
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.  
Correct answer: To work with this question, an Exam Simulator is required.
Explanation:
Box 1: SELECT..COALESCE…The COALESCE function evaluates the arguments in order and returns the current value of the first expression that initially does not evaluate to NULL. Box 2: ..LEFT OUTER JOIN..The LEFT JOIN (LEFT OUTER JOIN) keyword returns all rows from the left table (table1), with the matching rows in the right table (table2). The result is NULL in the right side when there is no match. A customer might have no orders so the right table must be allowed have a NULL value. Box 3: ON c.custid = o.custidWe JOIN on the custID column, which is available in both tables. Box 4: GROUP BY c.custidReferences:https://technet.microsoft.com/en-us/library/ms189499(v=sql.110).aspxhttp://www.w3schools.com/sql/sql_join_left.asp
Box 1: SELECT..COALESCE…
The COALESCE function evaluates the arguments in order and returns the current value of the first expression that initially does not evaluate to NULL. 
Box 2: ..LEFT OUTER JOIN..
The LEFT JOIN (LEFT OUTER JOIN) keyword returns all rows from the left table (table1), with the matching rows in the right table (table2). The result is NULL in the right side when there is no match. A customer might have no orders so the right table must be allowed have a NULL value. 
Box 3: ON c.custid = o.custid
We JOIN on the custID column, which is available in both tables. 
Box 4: GROUP BY c.custid
References:
https://technet.microsoft.com/en-us/library/ms189499(v=sql.110).aspx
http://www.w3schools.com/sql/sql_join_left.asp
Question 2
You run the following Transact-SQL statement:
   
You need to ensure that you can insert data into the table. 
What are the characteristics of the data? To answer, select the appropriate options in the answer area. 
Correct answer: To work with this question, an Exam Simulator is required.
Explanation:
Box 1: custidIDENTITY indicates that the new column is an identity column. When a new row is added to the table, the Database Engine provides a unique, incremental value for the column. Identity columns are typically used with PRIMARY KEY constraints to serve as the unique row identifier for the table. Box2: postalcodepostalcode is declared as NOT NULL, which means that a value must be inserted. Box 3: regionFax is also a correct answer. Both these two columns are declared as NULL, which means that data entry is optional. References: https://msdn.microsoft.com/en-us/library/ms174979.aspx
Box 1: custid
IDENTITY indicates that the new column is an identity column. When a new row is added to the table, the Database Engine provides a unique, incremental value for the column. Identity columns are typically used with PRIMARY KEY constraints to serve as the unique row identifier for the table. 
Box2: postalcode
postalcode is declared as NOT NULL, which means that a value must be inserted. 
Box 3: region
Fax is also a correct answer. Both these two columns are declared as NULL, which means that data entry is optional. 
References: https://msdn.microsoft.com/en-us/library/ms174979.aspx
Question 3
You create a table named Sales.Orders by running the following Transact-SQL statement:
   
 
You need to write a query that meets the following requirements:
  • removes orders from the table that were placed before January 1, 2012 
  • uses the date format of YYYYMMDD 
  • ensures that the order has been shipped before deleting the record 
Construct the query using the following guidelines:
  • use one-part column names and two-part table names 
  • do not use functions 
  • do not surround object names with square brackets 
  • do not use variables 
  • do not use aliases for column names and table names 
   
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.
  1. See the solution below
Correct answer: A
Explanation:
DELETE FROM Sales.Orders WHERE OrderDate < '2012-01-01' AND ShippedDate NOT NULL References:https://msdn.microsoft.com/en-us/library/ms189835.aspxhttps://msdn.microsoft.com/en-us/library/bb630352.aspx
DELETE FROM Sales.Orders 
WHERE OrderDate < '2012-01-01' AND ShippedDate NOT NULL 
References:
https://msdn.microsoft.com/en-us/library/ms189835.aspx
https://msdn.microsoft.com/en-us/library/bb630352.aspx
Question 4
You have a database that contains the following tables. 
   
You need to create a query that lists the lowest-performing salespersons based on the current year-to-date sales period. The query must meet the following requirements:
  • Return a column named Fullname that includes the salesperson FirstName, a space, and then LastName. 
  • Include the current year-to-date sales for each salesperson. 
  • Display only data for the three salespersons with the lowest year-to-year sales values. 
  • Exclude salespersons that have no value for TerritoryID. 
Construct the query using the following guidelines:
  • Use the first letter of a table name as the table alias. 
  • Use two-part column names. 
  • Do not surround object names with square brackets. 
  • Do not use implicit joins. 
  • Use only single quotes for literal text. 
  • Use aliases only if required. 
   
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.
  1. See the solution below
Correct answer: A
Explanation:
SELECT TOP(3) FirstName + ' ' + LastName AS Fullname, S.SalesYTD FROM Person as P INNER JOIN SalesPerson AS S ON P.PersonID = S.SalesPersonID WHERE S.TerritoryID IS NOT NULL ORDER BY S.SalesYTD ; On ordering: ASC | DESCSpecifies that the values in the specified column should be sorted in ascending or descending order. ASC sorts from the lowest value to highest value. DESC sorts from highest value to lowest value. ASC is the default sort order. Null values are treated as the lowest possible values. References: https://msdn.microsoft.com/en-us/library/ms189463.aspx
SELECT TOP(3) FirstName + ' ' + LastName AS Fullname, S.SalesYTD 
FROM Person as P INNER JOIN SalesPerson AS S 
ON P.PersonID = S.SalesPersonID 
WHERE S.TerritoryID IS NOT NULL 
ORDER BY S.SalesYTD 
On ordering: ASC | DESC
Specifies that the values in the specified column should be sorted in ascending or descending order. ASC sorts from the lowest value to highest value. DESC sorts from highest value to lowest value. ASC is the default sort order. Null values are treated as the lowest possible values. 
References: https://msdn.microsoft.com/en-us/library/ms189463.aspx
Question 5
You have a database that contains the following tables. 
   
You need to create a query that lists all complaints from the Complaints table, and the name of the person handling the complaints if a person is assigned. The ComplaintID must be displayed first, followed by the person name. 
Construct the query using the following guidelines:
  • Use two-part column names. 
  • Use one-part table names. 
  • Do not use aliases for column names or table names. 
  • Do not use Transact-SQL functions. 
  • Do not use implicit joins. 
  • Do not surround object names with square brackets. 
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.
  1. See the solution below
Correct answer: A
Explanation:
SELECT Complaints.ComlaintID, Persons.Name FROM Persons JOIN Contacts ON Persons.PersonID=Contacts.PersonID JOIN Complaints ON Contacts.ComplaintID=Complaints.ComplaintID References: https://technet.microsoft.com/en-us/library/ms190014(v=sql.105).aspx
SELECT Complaints.ComlaintID, Persons.Name 
FROM Persons 
JOIN Contacts 
ON Persons.PersonID=Contacts.PersonID 
JOIN Complaints 
ON Contacts.ComplaintID=Complaints.ComplaintID 
References: https://technet.microsoft.com/en-us/library/ms190014(v=sql.105).aspx
Question 6
You have a database that includes the tables shown in the exhibit. (Click the exhibit button.) 
   
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 7
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.    
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 8
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 are creating a report to show when the first customer account was opened in each city. The report contains a line chart with the following characteristics:
  • The chart contains a data point for each city, with lines connecting the points. 
  • The X axis contains the position that the city occupies relative to other cities. 
  • The Y axis contains the date that the first account in any city was opened. 
An example chart is shown below for five cities:
   
During a sales promotion, customers from various cities open new accounts on the same date. 
You need to write a query that returns the data for the chart. 
How should you complete the Transact-SQL statement? To answer, drag the appropriate Transact-SQL segments to the correct locations. Each Transact-SQL segment 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. 
NOTE: Each correct selection is worth one point.
Correct answer: To work with this question, an Exam Simulator is required.
Explanation:
Box 1: RANK() OVERRANK returns the rank of each row within the partition of a result set. The rank of a row is one plus thenumber of ranks that come before the row in question. ROW_NUMBER and RANK are similar. ROW_NUMBER numbers all rows sequentially (for example 1, 2, 3, 4, 5). Incorrect Answers:DENSE_RANK returns the rank of rows within the partition of a result set, without any gaps in the ranking. The rank of a row is one plus the number of distinct ranks that come before the row in question. Box 2: (PARTITION BY CityID ORDER BY MIN(AccountOpenedDate) DESC)Syntax for RANK: RANK ( ) OVER ( [ partition_by_clause ] order_by_clause )  Box 3: GROUP BY CityIDReferences: https://msdn.microsoft.com/en-us/library/ms176102.aspx
Box 1: RANK() OVER
RANK returns the rank of each row within the partition of a result set. The rank of a row is one plus thenumber of ranks that come before the row in question. 
ROW_NUMBER and RANK are similar. ROW_NUMBER numbers all rows sequentially (for example 1, 2, 3, 4, 5). 
Incorrect Answers:
DENSE_RANK returns the rank of rows within the partition of a result set, without any gaps in the ranking. The rank of a row is one plus the number of distinct ranks that come before the row in question. 
Box 2: (PARTITION BY CityID ORDER BY MIN(AccountOpenedDate) DESC)
Syntax for RANK: RANK ( ) OVER ( [ partition_by_clause ] order_by_clause )  
Box 3: GROUP BY CityID
References: https://msdn.microsoft.com/en-us/library/ms176102.aspx
Question 9
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 10
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.    
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
HOW TO OPEN VCE FILES

Use VCE Exam Simulator to open VCE files
Avanaset

HOW TO OPEN VCEX AND EXAM FILES

Use ProfExam Simulator to open VCEX and EXAM files
ProfExam Screen

ProfExam
ProfExam at a 20% markdown

You have the opportunity to purchase ProfExam at a 20% reduced price

Get Now!