This question is based on the following SQL table MYSTUDENT: ROLLNO NAME SEC…

2022

This question is based on the following SQL table MYSTUDENT:

ROLLNO    NAME       SEC    MARKS
80105     MARIA      A      83.0
80108     AMAR       B      44.0
80109     MANPREET   A      92.0
80112     SAMEER     A      81.0
80115     AKBAR      B      NULL

Which SQL command can be used to display each distinct SEC value from MYSTUDENT?

  1. A.

    SELECT DISTINCT SEC FROM MYSTUDENT;

  2. B.

    SELECT DIFFERENT SEC FROM MYSTUDENT;

  3. C.

    SELECT ALL SEC FROM MYSTUDENT;

  4. D.

    SELECT UNIQUE SEC FROM MYSTUDENT;

Attempted by 1908 students.

Show answer & explanation

Correct answer: A

The query needs to display each SEC value only once.

In SQL, DISTINCT is used with SELECT to remove duplicate values from the result.

The SEC column contains repeated values A and B. Therefore:

SELECT DISTINCT SEC FROM MYSTUDENT;

will return the unique section values A and B. Hence, Option A is correct.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Up Lt Grade Assistant Teacher 2025