Which two Transact-SQL queries will achieve the goal?

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.

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.

A.

B.

C.

D.

Explanation:
Using Cross Joins
A cross join that does not have a WHERE clause produces the Cartesian product of the tables involved in thejoin. 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.

https://technet.microsoft.com/en-us/library/ms190690(v=sql.105).aspx
https://msdn.microsoft.com/en-us/library/hh213574.aspx



Leave a Reply 3

Your email address will not be published. Required fields are marked *


scotrid

scotrid

WHICH 2 …. there are 2 answers to provide !

Raavi

Raavi

A and B are correct answers