You work as a SQL Server 2012 database developer at ABC.com. You are developing a query for
a database driven Web application that allows visitors to vote for the cricket player of the week.
The number of votes is stored in a table named WeeklyVotes that has columns named Week,
PlayerName, Votes.
You need to write a Transact-SQL query that returns the cricket player that received the most
votes for each week, as well as the number of votes they received.
Which of the following SELECT statement would accomplish this task?
A.
SELECT PlayerName, Votes
FROM ( SELECT PlayerName, Votes,
RANK () OVER (PARTITION BY PlayerName ORDER BY Votes ASC) AS Rank
FROM WeeklyVotes ) AS tmp
WHERE Rank = 1
B.
SELECT PlayerName, Votes
FROM ( SELECT PlayerName, Votes,
RANK() OVER (PARTITION BY Week ORDER BY Votes DESC) AS Rank FROM WeeklyVotes)
AS tmp
WHERE Rank = 1
C.
SELECT PlayerName, Votes
FROM ( SELECT TOP 1 PlayerName, Votes,
RANK () OVER (PARTITION BY PlayerName ORDER BY Votes ASC) AS Rank
FROM WeeklyVotes
ORDER BY Rank) AS tmp
D.
SELECT PlayerName, Votes
FROM ( SELECT TOP 1 PlayerName, Votes,
RANXO OVER (PARTITION BY PlayerName ORDER BY Votes DESC) AS Rank
FROM WeeklyVotes
ORDER BY Rank) AS tmp
Explanation:
Option B
B, tested
The facts talked about within the write-up are several of the most effective available.
Below you will find the link to some sites that we assume you should visit.
we came across a cool internet site which you may possibly love. Take a look when you want
usually posts some pretty intriguing stuff like this. If youre new to this site
Every as soon as inside a though we pick out blogs that we study. Listed beneath are the most current web sites that we pick
the time to study or take a look at the material or web-sites we have linked to beneath the
Here is a superb Blog You may Uncover Interesting that we Encourage You
Here are a few of the web pages we advocate for our visitors
usually posts some pretty intriguing stuff like this. If you are new to this site
one of our visitors just lately encouraged the following website
The data talked about inside the post are a few of the very best readily available
Many thanks really beneficial. Will share site with my good friends
madden nfl 17 coins http://www.reflex-gaming-clan.de/index.php?site=profile&id=123249
Here is a great Blog You might Obtain Interesting that we Encourage You
although sites we backlink to beneath are considerably not associated to ours, we feel they may be really worth a go via, so possess a look
one of our visitors just lately advised the following website
we came across a cool web site that you just might delight in. Take a search when you want
we prefer to honor quite a few other online web-sites on the internet, even though they arent linked to us, by linking to them. Beneath are some webpages really worth checking out
just beneath, are various absolutely not connected sites to ours, nonetheless, they’re certainly really worth going over
the time to study or stop by the subject material or websites we have linked to below the
check below, are some entirely unrelated web sites to ours, however, they’re most trustworthy sources that we use