(G) Assuming that there is one more table COACHES in the database as shown below:
TABLE:COACHES
SPORTS PERSON |
SEX | COACH_NO |
---|---|---|
AJAY 1 | M | 1 |
SEEMA | F | 2 |
VINOD | M | 1 |
TANEJA | F | 3 |
What will be the output of the following query:
SELECT SPORTS PERSON, COACHNAME FROM CLUB,COACHES WHERE COACH_ID=COACH_NO
Ans:
SPORTS PERSON |
COACHNAME |
---|---|
AJAY 1 | KUKREJA |
SEEMA | RAVINA |
VINOD | KUKREJA |
TANEJA | KARAN |
1999:
5.) Given the following Teacher relation: Write SQL commands for questions (b) to (g). TEACHER
NO |
NAME | DEPARTMENT | DATEOFJOING | SALARY | SEX |
---|---|---|---|---|---|
1 | RAJA | COMPUTER | 21/5/98 | 8000 | M |
2 | SANGITA | History | 21/5/97 | 9000 | F |
3 | RITU | MATHS | 29/8/98 | 8000 | F |
4 | KUMAR | HISTORY | 13/6/96 | 10000 | M |
5 | VENKAT | MATHS | 31/10/99 | 8000 | M |
6 | SINDU | HISTORY | 21/5/86 | 14000 | F |
7 | ASHWARYA | MATHS | 11/1/98 | 12000 | F |
(b) To show all information about the teachers of history department.
Ans:select *from teacher where department=’history’;
(c) To list names of female teacher who are in math department.
Ans: select name from teacher where sex=’male’ and department= ’maths’;
d) To list names of all teacher with their date of joining in ascending order.
Ans:Select Name From Teacher order by dateofjoing;
(f) To count the number of teachers with age >23.
Ans: Select count(number of teachers) from ,teacher where age>23;
(g) To insert a new row in the teacher table with the following data: 9, “raja’, 26,“computer”, {13/5/95 }, 2300, “M”.
Ans: Insert into Teacher values(9,”raja”,26, ”computer”, {13/05/95},2300,”M”);
CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( [email protected] )