+1 vote
in Class 12 by kratos

Write SQL queries for (i) to (iv), which are based on the table: STUDENT given in the question 4(g):

(i) To display the records from table student in alphabetical order as per the name of the student.

(ii) To display Class, Dob and City whose marks is between 450 and 551.

(iii) To display Name, Class and total number of students who have secured more than 450 marks, class wise

(iv) To increase marks of all students by 20 whose class is “XII”

1 Answer

+2 votes
by kratos
 
Best answer

(i) SELECT * FROM STUDENT ORDER BY NAME;

(ii) SELECT CLASS,DOB,CITY FROM STUDENT WHERE MARKS BETWEEN 450 AND 551;

(iii) SELECT NAME,CLASS ,COUNT(*) FROM STUDENT GROUP BY CLASS HAVING MARKS>450;

(iv) UPDATE STUDENT SET MARKS=MARKS+20 where class=”XII”;

...