In a company's employee database, there is a table named 'Employees' that includes fields such as 'ID', 'Name', 'Department', and 'Email'. You are asked to retrieve a list of the names and email addresses of all employees who work in the 'Marketing' department. Which query would you use to accomplish this task?
You selected this option
SELECT * FROM Employees WHERE Department = 'Sales';
You selected this option
SELECT Name, Email FROM Employees;
You selected this option
SELECT Name, Email FROM Employees WHERE Department = 'Marketing';
You selected this option
SELECT Department FROM Employees WHERE Name = 'Marketing';
The correct answer is 'SELECT Name, Email FROM Employees WHERE Department = 'Marketing';' because it specifies that only the 'Name' and 'Email' columns should be selected ('SELECT Name, Email') from the 'Employees' table ('FROM Employees'), and only for those records where the 'Department' field matches 'Marketing' ('WHERE Department = 'Marketing';'). The other choices are incorrect as they either do not filter by the 'Marketing' department, do not select the specific columns needed, or use syntax that does not conform to correct SQL query structure.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is SQL and why is it important for databases?
Open an interactive chat with Bash
What do the terms 'SELECT', 'FROM', and 'WHERE' mean in SQL?
Open an interactive chat with Bash
What are the differences between the provided SQL query options?