Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
SQL Server Express
»
tsql code
tsql code
Rate Topic
Display Mode
Topic Options
Author
Message
debris_flow
debris_flow
Posted Friday, July 06, 2012 10:12 PM
Forum Newbie
Group: General Forum Members
Last Login: Tuesday, January 22, 2013 9:00 PM
Points: 2,
Visits: 18
Imagine a table which contains records for all weekly number of bugs
discovered by each QA analysts in the team for one year. Please describe a
simple SQL statement for identifying a winner (an employee who found the
biggest number of bugs during that year) by writing one statement?
Post #1326381
ChrisM@home
ChrisM@home
Posted Saturday, July 07, 2012 1:36 AM
SSC Eights!
Group: General Forum Members
Last Login: Today @ 12:56 PM
Points: 921,
Visits: 3,741
debris_flow (7/6/2012)
Imagine a table which contains records for all weekly number of bugs
discovered by each QA analysts in the team for one year. Please describe a
simple SQL statement for identifying a winner (an employee who found the
biggest number of bugs during that year) by writing one statement?
This is a simple exercise made difficult by having to imagine what the table and data look like. Read the link in my sig "please read this" and provide DDL for the table and DML for some sample data.
Otherwise you may have to imagine what the simple SQL statement might look like
Low-hanging fruit picker and defender of the moggies
For better assistance in answering your questions, please read
this
.
Understanding and using APPLY, (I)
and
(II)
Paul White
Hidden RBAR: Triangular Joins
/
The "Numbers" or "Tally" Table: What it is and how it replaces a loop
Jeff Moden
Post #1326397
debris_flow
debris_flow
Posted Saturday, July 07, 2012 7:31 AM
Forum Newbie
Group: General Forum Members
Last Login: Tuesday, January 22, 2013 9:00 PM
Points: 2,
Visits: 18
Thank you very much for your suggestion
Post #1326419
Jeff Moden
Jeff Moden
Posted Saturday, July 07, 2012 1:15 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 1:26 PM
Points: 32,906,
Visits: 26,791
debris_flow (7/6/2012)
Imagine a table which contains records for all weekly number of bugs
discovered by each QA analysts in the team for one year. Please describe a
simple SQL statement for identifying a winner (an employee who found the
biggest number of bugs during that year) by writing one statement?
This is a terrible homework problem.
It doesn't tell you what to do if there's a tie.
Some hints to solve this (and there are many different ways). Lookup the following in Books Online.
GROUP BY
SUM()
MAX()
ORDER BY
COMMON TABLE EXPRESSIONS (CTEs)
RANK()/DENSERANK()
ROW_NUMBER()
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #1326479
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.