Multiple choice

Consider the relation schema as follows. Employee (employee-name, sheet, city) Works (employee-name, company-name, salary) Company (Company-name, city) Manages (Employee-name, manager-name)

Write a SQL query that gives the names of the employee who works in the same city and having salary greater than equal to 17000 and less than equal to 35500.

  1. SELECT employee-name FROM employee, works, company WHERE salary between 17000 and 35500

  2. SELECT employee-name FROM employee, works, company GROUP BY company, city having salary between 17000 and 35500

  3. SELECT employee-name FROM employee, works, company GROUP BY city having salary between 17000 and 35500

  4. SELECT employee-name FROM employee, works, company GROUP BY city having salary > = 17000 and 35500 salary < = 35500

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Statement (2) will give the result of the requirement of the query. This statement will select the employees’ names from employee works, company and group them by same city, those who are having salary between 17000 and 35500.