Find all employees who work in the "Sales" department.

Write a SQL query to find the names of all employees who work in the "Sales" department, given two tables, "employees" and "departments".

Problem

Given two tables, "employees" and "departments", write a SQL query to find the names of all employees who work in the "Sales" department.
Example input:
employees table:
id | name | department
1 | John | Sales
2 | Jane | Marketing
3 | Joe | Sales
4 | Bill | Accounting
5 | Karen | IT
departments table:
id | name
1 | Sales
2 | Marketing
3 | Accounting
4 | IT
Example output:
John
Joe

Solution

This solution is in SQL. Our A.I. can create solutions in multiple languages.
by sarastevens
SELECT name FROM employees WHERE department = 'Sales';

/*

The above solution is optimal because it uses the WHERE clause to filter the results of the query to only include employees who work in the Sales department.

*/

A.I. Evaluation of the Solution

The candidate's solution is correct and demonstrates a good understanding of SQL. The solution is clear and concise.

Evaluated at: 2022-11-10 08:15:43