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

Remove Ads
Teachoo · Class 12 Explore Class 12
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh is an IIT Kanpur graduate and has been teaching for 16+ years. At Teachoo, he breaks down Maths, Science and Computer Science into simple steps so students understand concepts deeply and score with confidence.

Many students prefer Teachoo Black for a smooth, ad-free learning experience.