exam questions

Exam 70-761 All Questions

View all questions & answers for the 70-761 exam

Exam 70-761 topic 1 question 62 discussion

Actual exam question from Microsoft's 70-761
Question #: 62
Topic #: 1
[All 70-761 Questions]

Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section. You will NOT be able to return to it. As a result, these questions will not appear in the review screen.
A database has two tables as shown in the following database diagram:

You need to list all provinces that have at least two large cities. A large city is defined as having a population of at least one million residents. The query must return the following columns:
✑ tblProvince.ProvinceId
✑ tblProvince.ProvinceName
✑ a derived column named LargeCityCount that presents the total count of large cities for the province
Solution: You run the following Transact-SQL statement:

Does the solution meet the goal?

  • A. Yes
  • B. No
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️
The requirement to list all provinces that have at least two large cities is meet by the WHERE CitySummary.LargeCityCount >=2 clause.
CROSS APPLY willwork fine here.
Note:
The APPLY operator allows you to invoke a table-valued function for each row returned by an outer table expression of a query. The table-valued function acts as the right input and the outer table expression acts as the left input. The right input is evaluated for each row from the left input and the rows produced are combined for the final output. The list of columns produced by the APPLY operator is the set of columns in the left input followed by the list of columns returned by the right input.
There are two forms of APPLY: CROSS APPLY and OUTER APPLY. CROSS APPLY returns only rows from the outer table that produce a result set from the table-valued function. OUTER APPLY returns both rows that produce a result set, and rows that do not, with NULL values in the columns produced by the table- valued function.
References:
https://technet.microsoft.com/en-us/library/ms175156(v=sql.105).aspx

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Anette
Highly Voted 5 years, 2 months ago
It is Right
upvoted 7 times
...
Andres_
Most Recent 4 years, 9 months ago
The requirement to list all provinces that have at least two large cities is meet by the WHERE CitySummary.LargeCityCount >=2 clause. CROSS APPLY will work fine here.
upvoted 2 times
...
stm22
5 years ago
cross join with a where clause is like an inner join
upvoted 3 times
Braindripper
4 years, 10 months ago
its cross apply not cross join
upvoted 2 times
...
Andy7622
4 years, 8 months ago
Sorry, perhaps You meant 'Cross Apply'
upvoted 1 times
...
...
AI_Cheong
5 years, 3 months ago
Answer is B, the where citysummary.largecitycount >= 2 is wrong
upvoted 1 times
xd1
5 years, 3 months ago
no. Answer is A. the answer is right.
upvoted 16 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...