nerdexam
Oracle

1Z0-007 · Question #125

Evaluate this SQL statement: SELECT e.emp_name, d.dept_name FROM employees e JOIN departments d USING (department_id) WHERE d.department_id NOT IN (10,40) ORDER BY dept_name; The statement fails…

The correct answer is C. remove the table alias from the SELECT clause E. prefix the column in the ORDER BY clause with the table alias. Prefix the column in the ORDER BY Clause would cause the statement to succeed, assuming that the statement failed because the dept_name existed in employee & department tables. Not C: Removing the alias from the columns in the SELECT clause would cause the Statement to fail if…

Displaying Data from Multiple Tables and Subqueries

Question

Evaluate this SQL statement:

SELECT e.emp_name, d.dept_name FROM employees e JOIN departments d USING (department_id) WHERE d.department_id NOT IN (10,40) ORDER BY dept_name; The statement fails when executed. Which change fixes the error?

Options

  • Aremove the ORDER BY clause
  • Bremove the table alias prefix from the WHERE clause
  • Cremove the table alias from the SELECT clause
  • Dprefix the column in the USING clause with the table alias
  • Eprefix the column in the ORDER BY clause with the table alias
  • Freplace the condition

How the community answered

(40 responses)
  • B
    8% (3)
  • C
    85% (34)
  • D
    3% (1)
  • F
    5% (2)

Explanation

Prefix the column in the ORDER BY Clause would cause the statement to succeed, assuming that the statement failed because the dept_name existed in employee & department tables. Not C: Removing the alias from the columns in the SELECT clause would cause the Statement to fail if the columns existing in both tables.

Topics

#JOIN USING#table alias restriction#join syntax#query errors

Community Discussion

No community discussion yet for this question.

Full 1Z0-007 Practice