Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Worksheet - 2

Write the following queries using the above table:

a) To retrieve all the information about Teacher with ID=101. In this query
we have to specify all the attributes in the SELECT clause. An easier
way to do this is to use asterisk (*), which means all the attributes.

b) To find the names of all teachers earning more than 50000.

c) To display Teacher_ID, First_Name, Last_Name and Dept_No of


teachers who belongs to department number 4 or 7.

d) To retrieve names of all the teachers and the numbers of their


respective departments.

e) To retrieve names of all the teachers who belong to department 4.

f) To retrieve names of all the teachers starting from letter ‘S’


g) To retrieve names of all the teachers having 6 characters in the first
name and starting with ‘S’

h) To retrieve names of all the teachers having at least 6 characters in the


last name.

i) To list the names of all the Teachers in the descending order of their
names.

j) To retrieve the department numbers of all the teachers ordered by the


Department number and within each department ordered by the names
of the teachers in descending order.

k) To retrieve all the details of those employees whose last name is not
specified.

l) To find total salary of all the teachers.

m) To find the maximum and minimum salary.

n) To count the number of teachers earning more than Rs 40000.

o) To retrieve the number of teachers in Department 7.

You might also like