Saved Bookmarks
| 1. |
Write SQL commands for the following queries (i) to (v) based on the relations Teacher and Posting given below:Table : TeacherT_IDNameAgeDepartmentDate_of_joinSalaryGender1Jugal34Computer Sc10/01/201712000M2Shaemila31History24/03/200820000F3Sandeep32Mathematics12/12/201630000M4Sangeeta35History01/07/201540000F5Rakesh42Mathematics05/09/200725000M6Shyam50History27/06/200830000M7Shiv Om44Computer Sc25/02/201721000M8Shalakha33Mathematics31/07/201820000FTable : PostingP_IDDepartmentPlace1HistotyAgra2MathematicsRaipur3Computer ScienceDelhii. To show all information about the teacher of History department. ii. To list the names of female teachers who are in Mathematics department. iii. To list the names of all teachers with their date of joining in ascending order. iv. To display teacher’s name, salary, age for male teachers only. v. To display name, bonus for each teacher where bonus is 10% of salary. |
|
Answer» i. SELECT * FROM teacher WHERE department= “History”; ii. SELECT name FROM teacher WHERE department= “Mathematics” AND gender= “F”; iii. SELECT name FROM teacher ORDER BY date_of_join; iv. SELECT name, salary, age FROM teacher WHERE gender=’M’; v. SELECT name, salary*0.1 AS Bonus FROM teacher; |
|