Computer Science - Class 12
Chapter 9 - Structured Query Language

This question asked in CBSE SQP- 2020

Write output for SQL queries (i) to (iii), which are based on the table: STUDENT given below:

Question 2 Long Answer - image 1.jpg

Table: STUDENT

RollNo Name Class DOB Gender City Marks
1 Nanda X 06-06-1995 M Agra 551
2 Saurabh XII 07-05-1993 M Mumbai 462
3 Sonal XI 06-05-1994 F Delhi 400
4 Trisla XII 08-08-1995 F Mumbai 450
5 Store XII 08-10-1995 M Delhi 369
6 Marisla XI 12-12-1994 F Delhi 250
7 Neha X 08-12-1995 F Moscow 377
8 Nishant X 12-06-1995 M Moscow 489

Question 1 (i)

SELECT COUNT(*), City FROM STUDENT GROUP BY CITY HAVING COUNT(*)>1;

Answer:

The query will display the number of students and city names which have more than 1 student from the same city.

Question 1(i) Long Answer - image 1.jpg

Question 1 (ii)

SELECT MAX(DOB),MIN(DOB) FROM STUDENT;

Answer:

The query will display the highest and lowest values in the column DOB.

Question 1(ii) Long Answer - image 1.jpg

Question 1 (iii)

SELECT NAME,GENDER FROM STUDENT WHERE CITY=”Delhi”;

Answer:

The query will display the name and gender of students from Delhi.

Question 1(iii) Long Answer - image 1.jpg

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.