Вы находитесь на странице: 1из 4

Instructions:

• Please write your name and contact info ONLY on the answer sheet
• This test paper consists of one section only. You are expected to write the complete SQL
queries for the questions using the given data model. There is reference data available,
but use this only as a reference (for understanding only) and not to write the query
• Marks for each question in the test varies. Q1-Q5 are of 2 marks each, Q6-Q10 are of 3
marks each and Q11 & Q12 are of 5 marks each
• A data model and some reference data are given in the next sheet. Understand the
purpose of each table & columns in it and infer the joining keys between tables
• You can assume the dates in the database to be in any one of the standard date formats
(DD/MM/YYYY, DD-MM-YYYY, YYYY-MM-DD, YYYY/MM/DD)
• You can assume that data model is snapshot of 1 year. Assume one teacher teaches only
one subject

Write SQL queries for the below questions. If you need any reference sample data, it is available
in the next sheet (Use this data only as a reference and not to calculate answer for any of the
below questions).

• Write a query to find the number of students in each class whose name ends with “gh” (2
Marks)

1. In the school there are multiple teachers for each subject. Write a query to get the number
of teachers for each subject taught (2 Marks)

1. The principal of the school wants to identify the newest teacher across genders who teach
Maths. Write a single query that will help him identify the same (2 Marks)

1. Every class in a school has students with slightly different age. The principal wants to
know the difference between the maximum and minimum student age of each standard at this
school. Write a query to extract the same (2 Marks)

1. The principal of the school wants to understand the work load distribution among male
and female staff. Provide a single query that computes the % classes taught by male teachers and
% classes taught by female teachers (2 Marks)

1. Every question paper for an exam will have contribution from all the teachers who are
teaching the corresponding standard and subject. Write a query to identify the number of
question papers each teacher contributed to (3 Marks)

1. Every teacher taking a class will interact with all the students in that class. Write a query
to identify the standard wise number of students each teacher interacts with (3 Marks)
1. The principal of the school wants to recognize the teachers by ranking them based on
their contributions (number of classes taught). Write a query to assign ranks (continuous) to
teachers, who are teaching more than 2 classes, based on their contribution (3 Marks)

1. There are multiple exams that each student must take throughout the year. There is a
chance that a student might miss few exams. Write a query to identify the students who missed
any exam in ‘Annual’ exams and the number of exams missed (3 Marks)

1. For every exam class teacher must assign grades to their students based on the percentage
of marks they have obtained in the exam. Write a query to allocate “Annual” exam grade to each
student based on the below criteria
grade A >=90%
grade B >=75% and <90%
grade C >=60% and <75%
grade D >=40% and <60%
grade F <40% (3 Marks)

1. Class teachers must keep track of the cumulative marks obtained (in exams) over the year
for each student in their class. Our teachers forgot to keep track of this data and need your help.
Write a query to provide the cumulative marks obtained till each exam (including that exam) for
every student (5 Marks)
Note: Exams are created in order. Ex: Quarterly followed by Half-yearly, followed by
Annual.

1. Every class must be assigned teachers for all the subjects present in the curriculum of the
standard. There is a chance that no teacher is assigned for a subject in the curriculum. Write a
query that identifies the class and subject for which teacher is not assigned (5 Marks)

Вам также может понравиться