You develop a Microsoft SQL Server database.
The database contains a table defined by the following Transact-SQL statement:
All regions have more than one employee.
You need to write a query to find the employee with the highest SalesYTD in each region with the following result set:
– First Name
– Last Name
– Region
– Sales YTD
Which Transact-SQL query should you run?
A)
B)
C)
D)
A . Option A
B . Option B
C . Option C
D . Option D
Answer: A
Explanation:
Use TOP 1 and RANK () OVER (PARTITION BY).
References: https://docs.microsoft.com/en-us/sql/t-sql/functions/rank-transact-sql?view=sqlserver-2017