Question:

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
collegedunia
Verified By Collegedunia

The Correct Option is D

Solution and Explanation

Let's analyze the syntax of each SQL statement.
(A)Select from emp where empid = 1003;`: This is a standard and syntactically correct SQL query. It selects all columns (``) from theemp` table for the row whereempid` is 1003.
(B)Select empid from emp where empid = 1002;`: This is also a standard and syntactically correct query. It selects theempid` column for the specified row.
(C)Select empid from emp;`: This is also a syntactically correct query. It selects theempid` column for all rows in theemp` table.
(D)Select ALL from emp where empid = 1001;`: This statement has a syntax error. The keywordALL` is used to return all values in a result set, including duplicates. It is the default behavior and is used likeSELECT ALL column_name` or in set operations. It cannot be used in place of a column list or the` wildcard. The correct way to select all columns is with an asterisk (``), as inSELECT FROM ...`.
Therefore, statement (D) contains a syntax error.
Was this answer helpful?
0
0