2025050212520674718_MySQL Queries
2025050212520674718_MySQL Queries
Q1. Write SQL Commands for (a) to (d) and write the outputs for (e) on the basis of table
TABLE: GRADUATE
a. List the names of those students who have obtained DIV I sorted by NAME.
b. Display a report, listing NAME, STIPEND, SUBJECT and amount of stipend received in a
year assuming that the
STIPEND is paid every month.
c. To count the number of students who are either PHYSICS or COMPUTER SC graduates.
d. To insert a new row in the GRADUATE table: 11,"KAJ0L", 300, "computer sc", 75, 1
e. Give output for the following:
(i) Select MIN(Average) from Graduate where subject="PHYSICS";
(ii) SELECT SUM(STIPEND) from Graduate where Div=2;
(iii) Select AVG(Stipend) from Graduate where Average>=65;
(iv) Select count(Distinct Subject) from Graduate;
Q2.Consider the following EMP table and write the commands for the following:
Table: Emp
(i) To display names and drink codes of those drinks those have more than 120 calories.
(ii) To display drink codes, names and calories of all drinks, in descending order of calories.
(iii) To display names and price of drinks that have price in the range 12 to 18 [both 12 and 18
included)
(iv) Increase the price of all drinks in the given table by 10%.
(v) SELECT COUNT(DISTINCT(PRICE)) FROM SOFTDRINK;
(vi) SELECT MAX (CALORIES) FROM SOFTDRINK;
(vii) SELECT DNAME FROM SOFTDRINK WHERE DNAME LIKE "%Mango%";
Q4. Write SQL Commands for (i) to (iv) and write the outputs for (v) to (vii) on the basis of table:
Table: EXAM
(i) To list the names of those students, who have obtained Division as FIRST in the
ascending order of NAME.
(ii) To display a report listing NAME, SUBJECT and Annual stipend received assuming that
the stipend column has monthly stipend.
(iii) To count the number of students, who have either accounts or informatics as subject
(iv) To insert a new row in the table EXAM: 6,"Mohan",500,"English",73,"Second"
(v) Write a query to show the current date and time.
(vi) SELECT AVG(Stipend) FROM EXAM WHERE DIVISION="THIRD"
(vii) SELECT COUNT(DISTINCT Subject) FROM EXAM;
(viii) SELECT MIN(Average) FROM EXAM WHERE Subject="English";
Q 5. Write SQL Commands for (a) to (e) and write the outputs for (f) on the basis of table
Table : FURNITURE