0% found this document useful (0 votes)
2 views3 pages

SQL Questions Answers

The document contains SQL questions and their corresponding queries and outputs related to SCHOOL and ADMIN tables. It includes various operations such as selecting teachers with fewer periods, filtering by gender, and grouping subjects by minimum periods. Additionally, it demonstrates data manipulation commands like INSERT, DELETE, and UPDATE on the tables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

SQL Questions Answers

The document contains SQL questions and their corresponding queries and outputs related to SCHOOL and ADMIN tables. It includes various operations such as selecting teachers with fewer periods, filtering by gender, and grouping subjects by minimum periods. Additionally, it demonstrates data manipulation commands like INSERT, DELETE, and UPDATE on the tables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

SQL Questions and Answers with Outputs

Figure 1: SCHOOL and ADMIN Tables

Question a)
SQL Query:
SELECT TEACHERNAME, PERIODS FROM SCHOOL WHERE PERIODS < 25 ORDER BY
TEACHERNAME;

Output:
HARISH B 21

JEERAN 22

LISA ANAND 20

NANDITA RAI 18

UMA SHANKAR 24

YASHAN 19

Question b)
SQL Query:
SELECT TEACHERNAME, ADMIN.CODE, GENDER
FROM SCHOOL, ADMIN
WHERE SCHOOL.CODE = ADMIN.CODE AND GENDER LIKE 'FEMALE';

Output:

LISA ANAND 1203 FEMALE

NANDITA RAI 1009 FEMALE

Question c)
SQL Query:
SELECT TEACHERNAME, DESIGNATION
FROM SCHOOL, ADMIN
WHERE SCHOOL.CODE = ADMIN.CODE AND SUBJECT LIKE 'ENGLISH';

Output:

LISA ANAND COORDINATOR

UMA SHANKAR VICE PRINCIPAL

Question d)
SQL Query:
SELECT SUBJECT, MIN(PERIODS) FROM SCHOOL GROUP BY SUBJECT HAVING
MIN(PERIODS);

Output:

CHEMISTRY 21

ENGLISH 20
MATHS 19

PHYSICS 16

Question e)
SQL Query:
SELECT SCHOOL.CODE, TEACHERNAME, DESIGNATION, EXPERIENCE
FROM SCHOOL, ADMIN
WHERE SCHOOL.CODE = ADMIN.CODE AND EXPERIENCE > 10;

Question f)
SQL Query:
INSERT INTO SCHOOL VALUES (1011, 'VEENA', 'COMPUTER SCIENCE', '12/07/2000', 25,
10);

Question g)
SQL Query:
DELETE FROM ADMIN WHERE DESIGNATION = 'HOD';

Question h)
SQL Query:
UPDATE SCHOOL SET PERIODS = PERIODS + 2 WHERE SUBJECT = 'PHYSICS';

You might also like