# Miscellaneous > Structured Query Language (SQL) >  SQL question

## makhlo

Hey everybody,

I am new to sql and have a problem to find the solution for this exercise: *Find out the makers that sale PCs but not laptops.*

_The database scheme consists of four relations: 

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)_

*My own query:

select distinct maker from product, pc 
where product.model = pc.model
and type in('pc','printer')*

The problem is that i also get the makers who sells pc *and laptops*.

Thnx for any help,

----------


## skhanal

This assumes that model is unique across makers and pc and laptop do not share a model name (may be true)

select maker 
from product, pc
where product.model = pc.model
and model not in (select model from laptop)

----------


## sriakila

SELECT maker from product p,pc c where p.model=c.model 
AND type not in('laptop')

----------


## faisca

the answer is:

SELECT * FROM product WHERE not exists (select * from laptop where
product.MODEL=laptop.model) and MAKER not in (SELECT MAKER FROM   
product WHERE model in (SELECT model FROM laptop)) and maker in   
(SELECT MAKER FROM product WHERE model in (SELECT MODEL FROM pc))

----------

