Select one statement which contains error.

2021

Select one statement which contains error.

  1. A.

    select* from stock where stockid = 10008

  2. B.

    select stockid from stock where stockid = 10003

  3. C.

    select stockid from stock

  4. D.

    select stockid where stockid = 10005
    and Lastname = ‘johnson’

  5. E.

    Question not attempted

Attempted by 1075 students.

Show answer & explanation

Correct answer: D

To identify the statement with an error, analyze each SQL query for syntax correctness. Option A: The query uses SELECT * from stock where stockid = 10008. This is syntactically correct as it selects all columns from the table stock where stockid equals 10008. Option B: The query uses SELECT stockid from stock where stockid = 10003. This is syntactically correct as it selects the stockid column from the table stock where stockid equals 10003. Option C: The query uses SELECT stockid from stock. This is syntactically correct as it selects the stockid column from the table stock without a WHERE clause, which is allowed. Option D: The query uses SELECT stockid where stockid = 10005 and Lastname = 'johnson'. This is syntactically incorrect because it lacks the FROM clause, which is required to specify the table. Option E: This indicates the question was not attempted. It is not a SQL statement and does not contain a syntax error in the same way as the others. Therefore, the statement with an error is Option D due to the missing FROM clause.

Explore the full course: Up Lt Grade Assistant Teacher 2025