Question:medium

Which of the following SQL statements contains an error?

Show Hint

In aSELECT` statement,SELECT is the correct syntax for selecting all columns.SELECT ALL` is a keyword, but it's used differently, often before a column name (`SELECT ALL City`) and is the default behavior (opposite ofSELECT DISTINCT`). You cannot useSELECT ALL` in place ofSELECT.
Updated On: Jul 2, 2026
  • Select from emp where empid = 1003;
  • Select empid from emp where empid = 1002;
  • Select empid from emp;
  • Select ALL from emp where empid = 1001;
Show Solution

The Correct Option is D

Solution and Explanation

Step 1: Recall the two ways to specify columns in SELECT.
A SELECT statement needs either a list of specific column names, or the asterisk symbol to mean all columns. These are the only two valid ways to tell SQL what to retrieve.
Step 2: Check each statement against this rule.
Select all columns from emp where empid = 1003 uses the asterisk correctly. Select empid from emp where empid = 1002 and Select empid from emp both name a specific column correctly. All three are syntactically sound.
Step 3: Examine the odd one out.
Select ALL from emp where empid = 1001 tries to use the word ALL in place of a column list or the asterisk. In SQL, ALL is a keyword used together with a column list, as in SELECT ALL column_name, or inside set operations like UNION ALL, it cannot stand alone as a substitute for a column specification.
Step 4: Conclude.
The statement containing the syntax error is
\[ \boxed{\text{Select ALL from emp where empid = 1001;}} \]
Was this answer helpful?
0