Question:

Which one of the following given statements possibly contains the error?

Show Hint

Always remember: In SQL, FROM is required after SELECT to indicate the source table.
  • select * from emp where empid = 10003;
  • select empid from emp where empid = 10006;
  • select empid from emp;
  • select empid where empid = 1009 and Lastname = 'GELLER';
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is D

Solution and Explanation

Step 1: In SQL, a SELECT statement syntax is: \[ SELECT column\_names FROM table\_name WHERE condition; \] The FROM clause is mandatory to specify the source table.
Step 2: Let’s examine each option:
- (A) select * from emp where empid = 10003; → Valid SQL statement, retrieves all columns for empid 10003.
- (B) select empid from emp where empid = 10006; → Valid SQL statement, retrieves empid for the given condition.
- (C) select empid from emp; → Valid SQL statement, retrieves all empids from the table.
- (D) select empid where empid = 1009 and Lastname = 'GELLER'; → Missing FROM clause to specify the table, hence invalid.
Step 3: Therefore, the statement with the error is option (D).
Was this answer helpful?
0
0