sql - Find out the models and prices for all the products (of any type) produced by maker B -


i have 4 tables

table pc:

code    model   speed   ram hd      cd  price ------------------------------------------------ 1       1232    500     64  5.0     12x 600.0000 10      1260    500     32  10.0    12x 350.0000 11      1233    900     128 40.0    40x 980.0000 12      1233    800     128 20.0    50x 970.0000 2       1121    750     128 14.0    40x 850.0000 3       1233    500     64  5.0     12x 600.0000 4       1121    600     128 14.0    40x 850.0000 5       1121    600     128 8.0     40x 850.0000 6       1233    750     128 20.0    50x 950.0000 7       1232    500     32  10.0    12x 400.0000 8       1232    450     64  8.0     24x 350.0000 9       1232    450     32  10.0    24x 350.0000 

table laptop:

code    model   speed   ram hd      price       screen ------------------------------------------------------ 1       1298    350     32  4.0     700.0000    11 2       1321    500     64  8.0 9   70.0000     12 3       1750    750     128 12.0    1200.0000   14 4       1298    600     64  10.0    1050.0000   15 5       1752    750     128 10.0    1150.0000   14 6       1298    450     64  10.0    950.0000    12 

table printer:

code    model   color   type    price ---------------------------------------- 1       1276    n       laser   400.0000 2       1433    y       jet     270.0000 3       1434    y       jet     290.0000 4       1401    n       matrix  150.0000 5       1408    n       matrix  270.0000 6       1288    n       laser   400.0000 

table product:

maker   model   type -----------------------       1232    pc       1233    pc       1276    printer       1298    laptop       1401    printer       1408    printer       1752    laptop b       1121    pc b       1750    laptop c       1321    laptop d       1288    printer d       1433    printer e       1260    pc e       1434    printer e       2112    pc e       2113    pc 

this question.

find out models , prices products (of type) produced maker b.

select product.model, price product, pc product.model = pc.model , maker = 'b' union select product.model, price product, laptop product.model = laptop.model , maker = 'b' union select product.model, price product, printer product.model = printer.model , maker = 'b' 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -