CBSE Class 12 Computer Science Question 17 of 78

Simple Queries in SQL — Question 10

Back to all questions
10
Question

Question 10

Write SQL commands for the following on the basis of given table STUDENT :

Table : STUDENT

StudentNo.ClassNameGAMEGrade1SUPWGrade2
107SameerCricketBPhotographyA
118SujitTennisAGardeningC
127KamalSwimmingBPhotographyB
137VeenaTennisCCookingA
149ArchanaBasket BallALiteratureA
1510ArpitCricketAGardeningC
  1. Display the names of the students who are getting a grade 'C' in either GAME or SUPW.
  2. Display the different games offered in the school.
  3. Display the SUPW taken up by the students, whose name starts with 'A'.
Answer

1.

SELECT Name
FROM STUDENT
WHERE Grade1 = 'C' OR Grade2 = 'C' ;
Output
+-------+
| Name  |
+-------+
| Sujit |
| Veena |
| Arpit |
+-------+

2.

SELECT DISTINCT GAME
FROM STUDENT ;
Output
+-------------+
| GAME        |
+-------------+
| Cricket     |
| Tennis      |
| Swimming    |
| Basket Ball |
+-------------+

3.

SELECT SUPW
FROM STUDENT
WHERE Name LIKE 'A%' ;
Output
+------------+
| SUPW       |
+------------+
| Literature |
| Gardening  |
+------------+