CBSE Class 12 Computer Science
Question 18 of 78
Simple Queries in SQL — Question 11
Back to all questions 11
Question Write SQL commands for the following on the basis of given table SPORTS :
Table : SPORTS
| StudentNo. | Class | Name | Game1 | Grade1 | Game2 | Grade2 |
|---|---|---|---|---|---|---|
| 10 | 7 | Sameer | Cricket | B | Swimming | A |
| 11 | 8 | Sujit | Tennis | A | Skating | C |
| 12 | 7 | Kamal | Swimming | B | Football | B |
| 13 | 7 | Venna | Tennis | C | Tennis | A |
| 14 | 9 | Archana | Basketball | A | Cricket | A |
| 15 | 10 | Arpit | Cricket | A | Athletics | C |
- Display the names of the students who have grade 'C' in either Game1 or Game2 or both.
- Display the names of the students who have same game for both Game1 and Game2.
- Display the games taken up by the students, whose name starts with 'A'.
1.
SELECT Name
FROM SPORTS
WHERE Grade1 = 'C' OR Grade2 = 'C' ;+-------+
| Name |
+-------+
| Sujit |
| Venna |
| Arpit |
+-------+
2.
SELECT Name
FROM SPORTS
WHERE Game1 = Game2 ;+-------+
| Name |
+-------+
| Venna |
+-------+
3.
SELECT Game1, Game2
FROM SPORTS
WHERE Name LIKE 'A%' ;+------------+-----------+
| Game1 | Game2 |
+------------+-----------+
| Basketball | Cricket |
| Cricket | Athletics |
+------------+-----------+