Question

Write SQL commands for the following queries based on the relation Teacher given below:

Table: Teacher

No Name Age Department Date_of_join Salary Sex
1 Jugal 34 Computer 10/01/97 12000 M
2 Sharmila 31 History 24/03/98 20000 F
3 Sandeep 32 Maths 12/12/96 30000 M
4 Sangeeta 35 History 01/07/99 40000 F
5 Rakesh 42 Maths 05/09/97 25000 M
6 Shyam 50 History 27/06/98 30000 M
7 Shiv Om 44 Computer 25/02/97 21000 M
8 Shalakha 33 Maths 31/07/97 20000 F

(a) To show all information about the teacher of Computer department.

(b) To list the names of female teachers who are in Maths department.

(c) To list the names of all teachers with their date of joining in ascending order.

(d) To display teacher ’s name, salary, age for male teachers only.

(e) To count the number of teachers with Age >23.

Answer

(a) SELECT * FROM TEACHER WHERE DEPARTMENT = “Computer ”;

(b) SELECT NAME FROM TEACHER WHERE DEPARTMENT = “Maths ”AND SEX = “F ”;

(c) SELECT NAME FROM TEACHER ORDER BY DATE_OF_JOIN;

(d) SELECT NAME, SALARY, AGE FROM TEACHER WHERE SEX = “M ”;

(e) SELECT COUNT(*) FROM TEACHER WHERE AGE >23;

Need a full question paper?

Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.

Start Generating Free

Similar questions

Write a python program using function to check whether a number is Armstrong or not. The function will accept a number as parameter.
Write a python program using function to demonstrate random() along with list, tuple and dictionary. The program should do 3 things: (i) Should create the list of 5 random numbers between 10 to 99. (ii) Should create the tuple of 5 random numbers between 10 to 99. (iii) Should create the dictionary of 5 keys:values random characters as key and ASCII as its value.
Write a menu driven program to do the following option on binary file “Student”. The program should implement through list which contains student number, student name and marks. Student Menu ------------------ 1) Add New Student 2) Display student details 3) Search student 4) Update a Record 5) Delete a Record 6) Save & Quit
Write SQL commands for the statements (a) to (h) on the table HOSPITAL

(a) To insert a new row in the HOSPITAL table with the following data: 11,’ Kasif’, 37,’ENT’,’2018-02-25’, 300, ’M’.

(b) To set charges to NULL for all the patients in the Surgery department.

(c) To display patient details who are giving charges in the range 300 and 400 (both inclusive).

(d) To display the details of that patient whose name second character contains ‘a’.

(e) To display total charges of ENT Department.

(f) To display details of the patients who admitted in the year 2019.

(g) To display the structure of the table hospital.

(h) Write the command to create the above table.

Write a program to accept a number from the user and to check whether the entered number is prime number or not. The program should be implemented in two ways to show the efficiency of the code.
Write Push(Book) and Pop(Book) methods in Python to Add a new Book and Remove a Book from a List of Books, considering them to act as PUSH and POP
operations of the data structure Stack.
Write the function Bubble() to sort the list using Bubble sort technique. The function will take the list as parameter.
Write a python program using function to accept a list as parameter and print all the even number in the list.
Consider the following table Bank.

Table: Bank

AccNo Cust_name FD_Amount Months Int_Rate FD_Date
1001 Arti Gupta 30000 36 6.00 2018-07-01
1002 Dilip Lal 50000 48 6.75 2018-03-22
1003 Navin Gupta 30000 36 NULL 2018-03-01
1004 D.P. Yadav 80000 60 8.25 2017-06-12
1005 Jyoti Sharma 20000 36 6.50 2017-01-31
1006 Rakesh Kumar 70000 60 8.25 2018-06-15
1007 K.D. Singh 50000 48 NULL 2018-07-05
1008 Anjali Sharma 60000 48 6.75 2017-04-02
1009 Swati Garg 40000 42 6.50 2018-06-15
1010 Rupinder Kaur 25000 36 6.50 2018-09-27

Write SQL commands for the statements (a) to (h) on the table Bank

(a) Display the details of all FD whose rate of interest is in the range 6% to 7%.

(b) Display the Customer Name and FD Amount for all the loans for which the number of Months is 24, 36, or 48(using IN operator).

(c) Display the Account Number, Customer Name and FD Amount for all the FD for which the Customer Name ends with “Sharma”.

(d) Delete the records of “Rupinder Kaur”.

(e) Add another column Maturity_Amt of type Integer in the Bank table.

(f) To find the average FD amount. Label the column as “Average FD Amount”.

(g) To find the total FD amount which started in the year 2018?

(h) Update Maturity Amount of all bank customers.

a. Maturity Amount = (FD_Amount*Months* Int_rate)/(12*100)

Write a python program using function to find greater number between two numbers. The function should take 2 numbers as parameters.