CBSE Class 12 Informatics Practices Question 71 of 90

Querying Using SQL — Question 11

Back to all questions
11
Question

Question 11

Given the following table :

Table : STUDENT

No.NameStipendStreamAvgMarkGradeClass
1Karan400.00Medical78.5B12B
2Divakar450.00Commerce89.2A11C
3Divya300.00Commerce68.6C12C
4Arun350.00Humanities73.1B12C
5Sabina500.00Nonmedical90.6A11A
6John400.00Medical75.4B12B
7Robert250.00Humanities64.4C11A
8Rubina450.00Nonmedical88.5A12A
9Vikas500.00Nonmedical92.0A12A
10Mohan300.00Commerce67.5C12C

Give the output of following SQL statements :

(i) SELECT MIN(AvgMark) FROM STUDENT WHERE AvgMark < 75 ;

(ii) SELECT SUM(Stipend) FROM Student WHERE Grade = 'B' ;

(iii) SELECT AVG(Stipend) FROM Student WHERE Class = '12A' ;

(iv) SELECT COUNT(DISTINCT) FROM Student ;

Answer

(i)

Output
+--------------+
| MIN(AvgMark) |
+--------------+
| 64.4         |
+--------------+

(ii)

Output
+--------------+
| SUM(Stipend) |
+--------------+
|         1150 |
+--------------+

(iii)

Output
+--------------+
| AVG(Stipend) |
+--------------+
|          475 |
+--------------+

(iv) It will give an error because the COUNT function requires an argument specifying what to count. Additionally, the DISTINCT keyword is followed by a column name to count the distinct values of that column.