Computer Science - Class 12
Chapter 9 - Structured Query Language

This question asked in CBSE Comptt., 2014

Consider the following tables SCHOOL and ADMIN and answer following questions:

Question 4 Long Answer 5 - image1.jpg

CODE  TEACHER SUBJECT DOJ PERIODS EXPERIENCE
1001 RAVI SHANKAR ENGLISH 12/03/2000 24 10
1009 PRIYA RAI PHYSICS 03/09/1998 26 12
1203 LIS ANAND ENGLISH 09/04/2000 27 5
1045 YASH RAJ MATHS 24/08/2000 24 15
1123 GANAN PHYSICS 16/07/1999 28 3
1167 HARISH B CHEMISTRY 19/10/1999 27 5
1215 UMESH PHYSICS 11/05/1198 22 16

 

Question 1 - image 1.jpg

CODE  GENDER DESIGNATION
1001 MALE VICE PRINCIPAL
1009 FEMALE COORDINATOR
1203 FEMALE COORDINATOR
1045 MALE HOD
1123 MALE SENIOR TEACHER
1167 MALE SENIOR TEACHER
1215 MALE HOD

Give the output of the following SQL queries:

Question 1 (i)

Select Designation Count (*) From Admin Group By Designation Having Count (*) <2;

 

Answer:

The query will display the designation and number of teachers grouped by their designation and having count less than 2.

Question 1(i) - image 1.jpg

Question 1(ii)

SELECT max (EXPERIENCE) FROM SCHOOL;

 

Answer:

The query will display the maximum value in the column EXPERIENCE of table SCHOOL.

Question 1(i) - image 2.jpg

Question 1(iii)

SELECT TEACHER FROM SCHOOL WHERE EXPERIENCE >12 ORDER BY TEACHER;

 

Answer:

The query will display the name of teachers who have more than 12 years of experience, in ascending order of names.

Question 1(iii) - image.jpg

Question 1(iv)

SELECT COUNT (*), GENDER FROM ADMIN GROUP BY GENDER;

 

Answer:

The query will display the number of male and female teachers.

Question 1(iv) - image.jpg


Transcript

Consider the following tables SCHOOL and ADMIN and answer following questions: Give the output of the following SQL queries: Question 1 (i) Select Designation Count (*) From Admin Group By Designation Having Count (*) <2; Answer: The query will display the designation and number of teachers grouped by their designation and having count less than 2. Question 1(ii) SELECT max (EXPERIENCE) FROM SCHOOL; Answer: The query will display the maximum value in the column EXPERIENCE of table SCHOOL. Question 1(iii) SELECT TEACHER FROM SCHOOL WHERE EXPERIENCE >12 ORDER BY TEACHER; Answer: The query will display the name of teachers who have more than 12 years of experience, in ascending order of names. Question 1(iv) SELECT COUNT (*), GENDER FROM ADMIN GROUP BY GENDER; Answer: The query will display the number of male and female teachers.

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.