Fewpal
0 votes
295 views
in Computer by (45.7k points)
closed by

Write SQL commands for the following queries (i) to (v) based on the relations Teacher and Posting given below:

Table : Teacher
T_IDNameAgeDepartmentDate_of_joinSalaryGender
1Jugal34Computer Sc10/01/201712000M
2Shaemila31History24/03/200820000F
3Sandeep32Mathematics12/12/201630000M
4Sangeeta35History01/07/201540000F
5Rakesh42Mathematics05/09/200725000M
6Shyam50History27/06/200830000M
7Shiv Om44Computer Sc25/02/201721000M
8Shalakha33Mathematics31/07/201820000F

Table : Posting
P_IDDepartmentPlace
1HistotyAgra
2MathematicsRaipur
3Computer ScienceDelhi

i. 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.

1 Answer

+1 vote
by (48.9k points)
selected by
 
Best 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;

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...