[Assignments] Simple Queries in SQL — Chapter 12 Assignments (Q/A)
Table of Contents
19. Write SQL commands for the following on the basis of given table Teacher:
No. | Name | Age | Department | Dateofjoin | Salary | Sex |
---|---|---|---|---|---|---|
1 | Jugal | 34 | Computer | 10.1.97 | 12000 | M |
2 | Sharmila | 31 | History | 24.3.98 | 20000 | F |
3 | Sandeep | 32 | Maths | 12.12.96 | 30000 | M |
4 | Sangeeta | 35 | History | 1.7.99 | 40000 | F |
5 | Rakesh | 42 | Maths | 5.9.97 | 25000 | M |
6 | Shyam | 50 | History | 27.6.98 | 30000 | M |
7 | Shiv Om | 44 | Computer | 25.2.97 | 21000 | M |
8 | Shalakha | 33 | Maths | 31.7.97 | 20000 | F |
- To show all information about the teacher of history department.
- To list the names of female teachers who are in Hindi department.
- To list names of all teachers with their date of joining in ascending order.
Solution:
SELECT * FROM Teacher
WHERE Department = "History";SELECT Name FROM Teacher
WHERE Sex = "F" AND Department = "Hindi";SELECT Name, Dateofjoin FROM Teacher
ORDER BY Dateofjoin;