[Assignments] Simple Queries in SQL — Chapter 12 Assignments (Q/A)
Table of Contents
10. Write SQL commands for the following on the basis of given table STUDENT:
StudentNo | Class | Name | GAME | Grade1 | SUPW | Grade2 |
---|---|---|---|---|---|---|
10 | 7 | Sameer | Cricket | B | Photography | A |
11 | 8 | Sujit | Tennis | A | Gardening | C |
12 | 7 | Kamal | Swimming | B | Photography | B |
13 | 7 | Veena | Tennis | C | Cooking | A |
14 | 9 | Archana | Basketball | A | Literature | A |
15 | 10 | Arpit | Cricket | A | Gardening | C |
- Display the names of the students who are getting a grade ‘C’ in either GAME or SUPW.
- Display the different games offered in the school.
- Display the SUPW taken up by the students, whose name starts with ‘A’.
Solution:
SELECT Name FROM STUDENT
WHERE Grade1 = 'C' OR Grade2 = 'C';SELECT DISTINCT Game FROM STUDENT;
SELECT Name, SUPW AS "SUPW WITH NAME A" FROM STUDENT
WHERE Name LIKE "A%";