Question

Consider the following table Student & Stream.

Table: Student

Admno Sname Class Sec Fee Mobile Area S_ID
1001 RAMESH XII A 2500 987654321 Madipur 10
1078 KRISHNA XII B 2400 999911111 Jawala Heri 30
1006 FARDEEN XII C 2600 987654321 Paschim Puri 40
1004 SUBHAM XII A 2500 963025874 Madipur 20
1029 KRITIKA XI C 2700 987456210 Madipur 30
1008 SAMEEKSHA XII A 2450 987123456 Mangol Puri 20
1025 SALMA XII B 2580 998877445 Madipur 30
1036 AMANDEEP XII B 2600 999333555 Khyala 40
1037 TEJAS XI C 2650 987951357 Paschim Puri 40
1029 HIMANSHU XII A 2750 951369874 Jawala Heri 10

Table : Stream

S_ID Stream_name
10 MEDILCAL
20 NON MEDICAL
30 COMMERCE WITH MATH
40 COMMERCE WITH IP
50 HUMANITIES

Write SQL commands for the statements (a) to (h) on the table: Student and Stream
(a) Display class and total fee collected from each class.
(b) Display admission no, students name and stream name.
(c) Display all the student details who have taken Commerce Stream.
(d) Count number of students who have opted for HUMANITIES stream.
(e) Display information of commerce with ip students whose name start with ‘S’. Arrange the record by admission number.
(f) Display details of all students who are in the MEDICAL stream.
(g) Display total fee of ‘Non-Medical’ Student.
(h) Change the name of the Column Sname to Student_Name.

Answer

(a) Select Class, Sum(Class) from Student group by Class;
(b) Select admno, sname, stream_name from student, stream where student.s_id=steam.s_id;
OR
Select admno, sname, stream_name from student s1, steam s2 where s1.s_id = s2.s_id;
(c) Select * from student, stream where student.s_id = stream.S_id and stream_name like ‘COMMERCE%’;
(d) Select count(Stream_Name) from student, stream where student.s_id=stream.s_id and stream_name = ‘HUMANITIES’;
(e) Select admno, sname, Class, Sec, Fee, Mobile, Area, Student.S_ID, Stream_Name from student, Stream where Student.S_ID = Stream.S_ID and Sname like ‘S%’ order by admno asc,;
(f) Select * from student, stream where student.s_id and stream_name=‘Medical’;
(g) Select sum(Fee) from Student, Stream where Student.S_ID=Stream.S_ID and Stream_name = ‘NON MEDICAL’.
(h) Alter table student change Student_Name varchar(20);

Need a full question paper?

Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.

Start Generating Free