Two database tables are defined as employees(emp_id, emp_name, dept_id) and departments(dept_id, dept_name). Which of the following SQL queries correctly lists each employee's name together with the name of the department that the employee belongs to?
SELECT e.emp_name, d.dept_name FROM employees e JOIN departments d ON e.dept_id = d.dept_id;
SELECT emp_name, dept_name FROM employees, departments;
SELECT e.emp_name, d.dept_name FROM employees e JOIN departments d ON e.emp_name = d.dept_name;
SELECT emp_name, dept_name FROM employees UNION SELECT dept_id, dept_name FROM departments;
The verified answer and full solution are one login away
Every answer here is machine verified, with a step-by-step solution that teaches the method. Your login also unlocks a 7-question mock preview in the real exam interface.
Log in to see the answerMore sql questions