Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL exercise problem
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

2 Posts

Posted - 05/11/2012 :  04:32:45  Show Profile  Reply with Quote
Was hoping someone may be able to help me, the question I am trying is from


The database scheme consists of four tables:
Product(maker, model, type)
PC(code, model, speed, ram, hd, cd, price)
Laptop(code, model, speed, ram, hd, screen, price)
Printer(code, model, color, type, price)

Exercise: 25
Find the printer makers which also produce PCs with the lowest RAM and the highest-speed processor among PCs with the lowest RAM. Result set: maker.


I've tried attempting this from several different angles and have had different problems with each attempt, however in each I've been able to see why it wont work, except this one:

PC ON PC.model = product.model INNER JOIN
(SELECT p.ram, MAX(p.Speed) as speed FROM pc p
    GROUP BY p.ram
    HAVING p.ram = 
        (SELECT MIN(ram) FROM pc)
   )T ON T.ram = pc.ram AND T.speed = pc.speed

It says on a testing table that it gave an extra record by 1.

As I see it the subquery should pull out [min ram][max speed] fine then by joining this into the Product table joined with the PC table only the results which satisfy the subquery should be returned?

Edited by - rob887 on 05/11/2012 04:45:41

Constraint Violating Yak Guru

354 Posts

Posted - 05/11/2012 :  06:01:11  Show Profile  Reply with Quote
can you provide sample data for all tables?
Go to Top of Page

Starting Member

2 Posts

Posted - 05/11/2012 :  06:11:35  Show Profile  Reply with Quote
you know what... I went to grab you the sample data and for the tables I've used and noticed what the problem is. I haven't included the fact that they only want printer manufacturers :(. Been looking at this for hours and missed the obvious!!!
Go to Top of Page

Starting Member

4 Posts

Posted - 01/22/2013 :  17:33:35  Show Profile  Reply with Quote
I'm stuck in this :(
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000