KnowledgeBoat Logo

Computer Science

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 :

  1. SELECT MIN(AvgMark) FROM STUDENT WHERE AvgMark < 75 ;
  2. SELECT SUM(Stipend) FROM STUDENT WHERE Grade = 'B' ;
  3. SELECT AVG(Stipend) FROM STUDENT WHERE Class = '12A' ;
  4. SELECT COUNT(DISTINCT) FROM STUDENT ;

SQL Queries

18 Likes

Answer

1.

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

2.

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

3.

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

4. 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.

Answered By

12 Likes


Related Questions