Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Subqueries Expand / Collapse
Author
Message
Posted Sunday, November 10, 2013 2:45 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Saturday, November 16, 2013 5:40 PM
Points: 1, Visits: 22
1. I need to find the names of the customers who have purchased academic books. (Coding required as Subquery NOT as Join)


2. Here, I need to show a list of authors who have written books
and list the books they have written.
Sort the list by last name
(Coding required as Subquery)

Thanks in advance.
Post #1512987
Posted Sunday, November 10, 2013 6:08 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 10:53 PM
Points: 3,421, Visits: 5,359
Any time I see something like "Coding required as Subquery NOT as Join" it tells me for sure this is homework.

You'll find that few on this forum are willing to do your homework for you.

However if you make a fair attempt at solving the problem, we're likely to try to help you get it right.

Suggest you post some table DDL and sample test data in a consumable form, along with your first attempt.



My mantra: No loops! No CURSORs! No RBAR! Hoo-uh!

My thought question: Have you ever been told that your query runs too fast?

My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.


Need to UNPIVOT? Why not CROSS APPLY VALUES instead?
Since random numbers are too important to be left to chance, let's generate some!
Learn to understand recursive CTEs by example.
Splitting strings based on patterns can be fast!
Post #1512993
Posted Sunday, November 10, 2013 10:05 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 8:38 PM
Points: 35,371, Visits: 31,912
dwain.c (11/10/2013)
Any time I see something like "Coding required as Subquery NOT as Join" it tells me for sure this is homework.

You'll find that few on this forum are willing to do your homework for you.

However if you make a fair attempt at solving the problem, we're likely to try to help you get it right.

Suggest you post some table DDL and sample test data in a consumable form, along with your first attempt.


+1 to all that. Well said on all fronts.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1512999
Posted Monday, November 11, 2013 9:51 PM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Wednesday, October 22, 2014 4:22 AM
Points: 720, Visits: 552
May be he want to learn about sub-queries.
Post #1513326
Posted Tuesday, November 12, 2013 2:28 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 10:53 PM
Points: 3,421, Visits: 5,359
T.Ashish (11/11/2013)
May be he want to learn about sub-queries.


Good point! In that case, I suggest to check here:

http://beginner-sql-tutorial.com/sql-subquery.htm



My mantra: No loops! No CURSORs! No RBAR! Hoo-uh!

My thought question: Have you ever been told that your query runs too fast?

My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.


Need to UNPIVOT? Why not CROSS APPLY VALUES instead?
Since random numbers are too important to be left to chance, let's generate some!
Learn to understand recursive CTEs by example.
Splitting strings based on patterns can be fast!
Post #1513368
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse