Task 15(computers)

–Dima and Misha use products of the same maker.

–Type of Tanya’s printer is not the same as that of Viktor, but a "color" property is match.

–Screen size of Dima’s laptop is more by 3 inches then Olga’s one.

–Misha’s PC is 4 times more expensive then Tanya’s printer.

–Model numbers of Viktor’s printer and Olga’s laptop differ with third symbol.

–Konstantin’s PC processor speed equals to that of Misha’s PC,

–hard drive equals to that of Dima’s laptop,

–ram equals to that of Olga’s laptop,

–and the price is the same as that of Viktor’s printer.

–List all the possible model numbers of Konstantin’s PC.



select distinct model from PC



(select Laptop.hd, x.speed, x.price, x.ram from Laptop

inner join

(select distinct maker, PC.speed, x.screen, x.price, x.ram from Printer p

inner join

(select distinct p.price, p.color, p.type, l.screen, l.ram from printer p –Viktor’s printer and Olga’s Laptop

cross join Laptop l

where substring(p.model, 1, 2) = substring(l.model, 1, 2)

and ( substring(p.model, 4, len(p.model)) = substring(l.model, 4, len(l.model) ))

and (substring(p.model, 3, 1) <> substring(l.model, 3, 1) and len(l.model) > 2 and len(p.model) > 2)

) x

on x.color = p.color and x.type <> p.type –Tanya’s printer

inner join PC on PC.price = p.price * 4

inner join Product prod on prod.model = PC.model

) x on Laptop.screen = x.screen + 3

and Laptop.model in (select model from Product where maker = x.maker)

) x


PC.speed = x.speed


PC.hd = x.hd


PC.ram = x.ram


PC.price = x.price

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s