Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
+1 vote
48.4k views
in Commerce by (72.4k points)

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;

1 Answer

0 votes
by (89.4k points)
selected by
 
Best answer

1. SELECT INAME FROM ITEMS ORDER BY INAME ASC;

2. SELECT INAME, PRICE FROM ITEMS WHERE PRICE => 10000 AND PRICE =< 22000; (c) SELECT TCODE, COUNT (CODE) FROM ITEMS GROUP BY TCODE;

3. SELECT PRICE, INAME, QTY FROM ITEMS WHERE (QTY> 150);

4. SELECT TNAME FROM TRADERS WHERE (CITY = “DELHI”) OR (CITY = “MUMBAI”)

5. SELECT COMPANY, INAME FROM ITEMS ORDER BY COMPANY DESC;

6. (hi) 38000 

1200 

(h2)1075000 

(h3)T01 

T02 

TO3 

(h4) LED SCREEN 40 DISP HOUSE INC CAR GPS SYSTEM ELECTRONICS SALES

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...