1.

Write SQL queries for (a) to (f) and write the outputs for the SQL queries mentioned shown in (gl) to (g4) parts on the basis of tables PRODUCTS and SUPPLIERS1. To display the details of all the products in ascending order of product names (i.e., PNAME).2. To display product name and price of all those products, whose price is in the range of 10000 and 15000 (both values inclusive).3. To display the number of products, which are supplied by each suplier. i.e., the expected output should be;S01 2S02 2S03 14. To display the price, product name and quantity (i.e., qty) of those products which have quantity more thhn 100.5. To display the names of those suppliers, who are either from DELHI or from CHENNAI.6. To display the name of the companies and the name of the products in descending order of company names.7. Obtain the outputs of the following SQL queries based on the data given in tables PRODUCTS and SUPPLIERS above.SELECT DISTINCT SUPCODE FROM PRODUCTS;SELEC MAX (PRICE), MIN (PRICE) FROM PRODUCTS;SELECT PRICE*QTY FROM PRODUCTS WHERE PID = 104; (g4)SELECT PNAME, SNAME FROM PRODUCTS P, SUPPLIERS S WHERE E SUPCODE = S. SUPCODE AND QTY>100;

Answer»

1. SELECT * FROM PRODUCTS ORDER BY PNAME ASC;

2. SELECT PNAME, PRICE FROM PRODUCTS WHERE ((PRICE => 10000) AND (PRICE = < 15000));

3. SELECT SUPCODE, COUNT (PID) FROM PRODUCTS GROUP BY SUPCODE;

4. SELECT PRICE, PNAME, QTY FROM PRODUCTS WHERE (QTY > 100);

5. SELECT SNAME FROM SUPPLIERS WHERE ((CITY = “DELHI”) OR (CITY = “CHENNAI”));

6. SELECT COMPANY, PNAME FROM PRO-DUCTS ORDER BY COMPANY DESC; 4

7. SOI1 

(gl)s02 

s03 

(g2) 28000 

1100 

(g3) 550000 

(g4) PNAME SNAME Vi 

DIGITAL CAMERA 14 X GETALL INC 

PENDRIVE16 GB GETALL INC



Discussion

No Comment Found