Write SQL queries for (a) to (g) and write the output for the SQL queries mentioned shown in (hi) to (h4) parts on the basis of table ITEMS and TRADERS :
1. To display the details of all the items in ascending order of item names (i.e., INAME).
2. To display item name and price of all those items, whose price is in the range of 10000 and 22000 (both values inclusive).
3. To display the number of items, which are traded by each trader. The expected output of this query should be:
4. To display the price, item name and quantity (i.e., qty) of those items which have quantity more than 150.
5. To display the names of those traders, who are either from DELHI or from MUMBAI.
6. To display the names of the companies and the names of the items in descending order of company names.
7. Obtain the outputs of the following SQL queries based on the data given in tables ITEMS and TRADERS above.
- SELECT MAX (PRICE), MIN (PRICE) FROM ITEMS;
- SELECT PRICE*QTY FROM ITEMS WHERE CODE-1004;
- SELECT DISTINCT TCODE FROM ITEMS;
- SELECT INAME, TNAME FROM ITEMS I, TRADERS T
WHERE I.TCODE=T.TCODE AND QTY< 100;