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

–model

–1232

select distinct model from PC

inner

join

(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

on

PC.speed = x.speed

and

PC.hd = x.hd

and

PC.ram = x.ram

and

PC.price = x.price