nerdexam
CompTIACompTIA

DS0-001 · Question #45

DS0-001 Question #45: Real Exam Question with Answer & Explanation

The correct answer is B: Select EmpId where EmpId=90030 and DeptId=34. Option B contains an error because it is missing the FROM clause - a required component of any SQL SELECT statement that specifies which table to query. The correct syntax would be SELECT EmpId FROM employee WHERE EmpId=90030 AND DeptId=34. Why the distractors are valid SQL: A is

Question

Which of the following statements contains an error?

Options

  • ASelect EmpId from employee where EmpId=90030
  • BSelect EmpId where EmpId=90030 and DeptId=34
  • CSelect* from employee where EmpId=90030
  • DSelect EmpId from employee

Explanation

Option B contains an error because it is missing the FROM clause - a required component of any SQL SELECT statement that specifies which table to query. The correct syntax would be SELECT EmpId FROM employee WHERE EmpId=90030 AND DeptId=34.

Why the distractors are valid SQL:

  • A is correct syntax: selects a column from a named table with a WHERE filter.
  • C is valid: SELECT* (even without a space) works in most SQL engines and returns all columns from employee.
  • D is valid: a SELECT with no WHERE clause is perfectly legal - it returns all rows.

Memory tip: Think of SQL's required skeleton as S-F-W (Select, From, Where) - From is the only non-optional part after Select. If a query skips FROM but still filters rows, it's broken before it even starts.

Community Discussion

No community discussion yet for this question.

Full DS0-001 PracticeBrowse All DS0-001 Questions