Prog 20 - 24
Prog 20 - 24
SQL COMMANDS -1
Mobile Master
M_ID M_COMPANY M_NAME M_PRICE M_MF_DATE
MB001 Samsung Galaxy 4500 2013-02-12
MB003 Nokia N1100 2250 2011-04-15
MB004 Micromax Unite3 4500 2016-10-17
MB005 Sony XperiaM 7500 2017-11-20
MB006 Oppo SelfieEx 8500 2010-08-21
Mobile Stock
S_ID M_ID M_Qty M_Supplier
S001 MB004 450 New Vision
S002 MB003 250 Praveen Gallery
S003 MB001 300 Classic Mobile Store
S004 MB006 150 A-one Mobiles
S005 MB003 150 The Mobile
S006 MB006 50 Mobile Centre
(i) Display the Mobile company, Mobile name & price in descending order of their
manufacturing date.
ANS:
(ii) List the details of mobile whose name starts with “S”.
ANS:
(iii) Display the Mobile supplier & quantity of all mo biles except “MB003‟.
ANS:
(iv) To display the name of mobile company having price between 3000 & 5000.
ANS:
i. Display the Trainer Name, City & Salary in descending order of their Hiredate.
ANS:
ii. To display the TNAME and CITY of Trainer who joined the Institute in the month of
December 2001.
ANS:
iii. To display TNAME, HIREDATE, CNAME, STARTDATE from tables TRAINER and
COURSE of all those courses whose FEES is less than or equal to 10000.
ANS:
vii. SELECT TID, COUNT(*), MIN(FEES) FROM COURSE GROUP BY TID HAVING
COUNT(*)>1;
viii. SELECT COUNT(*), SUM(FEES) FROM COURSE WHERE STARTDATE< ‘2018-09-15’;
22 – SQL COMMANDS - 3
ii) To display the details of courses whose fees is in the range of 15000 to 50000 (both
values included).
ANS:
iii) To increase the fees of all courses by 500 of “System Design” Course.
ANS:
(iv) To display details of those courses which are taught by ‘Sulekha’ in descending
order of courses.
ANS:
i. To display all the details of those watches whose name ends with ‘Time’
ANS:
ii. To display watch’s name and price of those watches which have price range in
between 5000-15000.
ANS:
iv. To display watch name and their quantity sold in first quarter.
ANS:
(i) To display the records from table student in alphabetical order as per the name of
the student.
ANS:
(ii ) To display Class, Dob and City whose marks is between 450 and 551.
ANS:
(iii) To display Name, Class and total number of st udents who have secured more than
450 marks, class wise
ANS:
-----xxx-----