SQL
SQL
4. Display name,ROLLNO AND SUBJECT whose average marks in between 75 and 100.
ANs: SELECT NAME, ROLLNO, SUBJECT FROM CLASS WHERE AVGMARK
BETWEEN 75 AND 100;
5. Display records of those students who secured marks more than 80 from non-medical.
Ans: SELECT *FROM CLASS WHERE AVGMARK>80 AND SUBJECT='NON-
MEDICAL';
6. Write SQL command to display records of students whose alphabet begins with ‘v’.
Ans: SELECT *FROM CLASS WHERE NAME LIKE'%V%';
7. Write SQL command to display records of students whose second alphabet is ‘A’.
Ans: SELECT *FROM CLASS WHERE NAME LIKE'_A%';
8.Write SQL command to Update the subject of rollno 4 from Non-medical to BCA.
UPDATE CLASS SET SUBJECT='BCA' WHERE ROLLNO='4';
9. Write SQL command to Delete the record of the student having rollno 2.
Ans : DELETE FROM CLASS WHERE ROLLNO='2';
10. Insert the new row with the following data. (6,'JACK',2800,'HUMANITIES',98,'A')
Ans: INSERT INTO CLASS VALUES
(6,'JACK',2800,'HUMANITIES',98,'A');
11. To list Name,Subject for all the students whose average mark is less than 70.
Ans: SELECT NAME, SUBJECT FROM CLASS WHERE AVGMARK<70;
12. To display name, subject,rollno, average mark in descending order of average marks from
the CLASS table.
Ans: SELECT NAME,SUBJECT,AVGMARK FROM CLASS ORDER BY AVGMARK
DESC;
13. Write a Update the stipend of the student to 1250, whose rollno is 3.
Ans: UPDATE CLASS SET STIPEND='1250' WHERE ROLLNO='3';
******************************