Q. In a Database Karnataka_Sangam there are two tables with the instances given below:
Table: STUDENTS
ADMNO |
NAME |
CLASS |
SEC |
RN |
ADDRESS |
PHONE |
1211 |
Meena |
12 |
D |
4 |
A-26 |
3245678 |
1212 |
Vani |
10 |
D |
1 |
B-25 |
5456789 |
1213 |
Meena |
12 |
A |
1 |
|
|
1214 |
Karish |
10 |
B |
3 |
AB-234 |
4567890 |
1215 |
Suraj |
11 |
C |
2 |
ZW12 |
4345677 |
Table: SPORTS
ADMNO |
GAME |
COACHNAME |
GRADE |
1215 |
Cricket |
Mr. Ravi |
A |
1213 |
Vollyball |
Ms. Chadha |
B |
1211 |
Vollyball |
Mr. Govardhan |
A |
1212 |
Basket Ball |
Mr. Tewani |
B |
Write SQL queries for the following:
(i) To count how many addresses are not having NULL values in the address column of STUDENTS table?
(ii) To display Name, Class from STUDENTS table and the corresponding Grade from SPORTS table. (iii) To display Name of the student and their corresponding Coachnames from STUDENTS and SPORTS tables.
Answer :-
i = Select Count(*) from student where Not ( Address is null ) ;
ii = Select Name, Class , Grade from student Natural join Sports ;
iii = Select Name, Coachname from student Natural join Sports ;
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )