Fewpal
0 votes
65 views
in Computer by (52.3k points)
closed by

Write SQL commands for the queries (i) to (iv) and output for (v) to (viii) based on the tables ‘Watches’ and ‘Sale’ given below :

                Watches

                          Sale

(i) To display all the details of those watches whose name ends with ‘Time’. 

(ii) To display watch’s name and price of those watches which have price range iii between 5000-15000. 

(iii) To display total quantity in store of Unisex type watches. 

(iv) To display watch name and their quantity sold in first quarter. 

(v) SELECT MAX(Price), MIN(Qty_Store) FROM Watches; 

(vi) SELECT Quarter, SUM(Qty_Sold) FROM Sale GROUP BY Quarter; 

(vii) SELECT Watch_Name, Price, Type FROM Watches w, Sale s WHERE w.Watchid!=s.Watchid;

(viii) SELECT Watch_Name, Qty_Store, SUM(Qty_Sold), Qty_Store SUM(Qty_Sold) "Stock" FROM Watches w, Sale s WHERE w.Watchid=s.Watchid GROUP BY s.Watchid;

1 Answer

+1 vote
by (47.6k points)
selected by
 
Best answer

(i) SELECT *

FROM Watches

WHERE Watch_Name LIKE '%Time'; 

(ii) SELECT Watch_Name, Price FROM Watches WHERE Price BETWEEN 5000 AND 15000;

(iii) SELECT SUM(Qty_Store) FROM Watches WHERE Type LIKE 'Unisex';

(iv) SELECT Watch_Name, Qty_Sold FROM Watches W, Sale S WHERE W.Watchid=S.Watchid AND Quarter = 1;

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

...