Question:

Consider the table 'STUDENT'

NameClassDOBGenderCityMarks
RohanXI2008MDelhi85
PriyaXII2006FMumbai92
AnkitXI2007MDelhi88
NidhiXII2006FMumbai90
AaravIX2009MKolkata78
SimranXI2007FChandigarh94
RahulXII2006MPune80


From the above table 'STUDENT', which query will return all the students from class 'XI'
 

Show Hint

In SQL:
1. Use SELECT * to project all attributes.
2. Use WHERE column = 'value' for strict string equality matching.
3. IN expects a parenthesized list like WHERE column IN ('A', 'B').
Updated On: Sep 8, 2026
  • SELECT * FROM STUDENT WHERE Class ='XI';
  • SELECT * FROM STUDENT WHERE LIKE 'XI';
  • SELECT Name, DOB FROM STUDENT WHERE Class $>$ 'XI';
  • SELECT * FROM STUDENT WHERE Class IN ='XI';
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

Concept:
SQL data retrieval uses the SELECT statement combined with the WHERE clause to filter tuples that satisfy a given conditional predicate.
The asterisk symbol (*) denotes that all columns of the matching tuples must be projected in the result set.

Step 1: Analysis of the Requirement:

The task is to retrieve all information (all columns) for students studying in class 'XI'.
To specify equality with a string literal in standard SQL, the equality comparison operator (=) is employed along with single quotes surrounding the string.
Hence, the correct syntax is:
SELECT * FROM STUDENT WHERE Class = 'XI';

Step 2: Error Analysis in Other Options:

Option (B) omits the attribute name before the operator and uses LIKE incorrectly without a column specification.
Option (C) only projects Name and DOB, failing to return all student details, and uses the inequality operator ($>$) instead of checking for equality.
Option (D) incorrectly combines the set operator IN with the equality operator =, which creates a syntax error in SQL.
Final Answer:
The correct and syntactically valid query is option (A).
Was this answer helpful?
0
0