Question

Given the following relation: STUDENT

Table: STUDENT

No. Name Age Department Dateofadm Fee Sex
1 Pankaj 24 Computer 10/01/97 120 M
2 Shalini 21 History 24/03/98 200 F
3 Sanjay 22 Hindi 12/12/96 300 M
4 Sudha 25 History 01/07/99 400 F
5 Rakesh 22 Hindi 05/09/97 250 M
6 Shakeel 30 History 27/06/98 300 M
7 Surya 34 Computer 25/02/97 210 M
8 Shikha 23 Hindi 31/07/97 200 F

Write SQL commands for the following queries
(a) To show all information about the students of History department.
(b) To list the names of female students who are in Hindi department.
(c) To list the names of all students with their date of admission in ascending order.
(d) To display student’s name, fee, age for male students only.
(e) To count the number of students with Age>23.

Answer

(a) Select * from student where department = “history”;
(b) Select * from student where department = “hindi” and sex=’f’;
(c) Select * from student order by dateofadm;
(d) Select name, fee, age from student where sex=“m”;
(e) Select count(*) from student age>23;

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

Explore more

Similar questions