Question 6
Consider the following relational schema:
Employee(emp_id, first_name, last_name, dept_id)
Department(dept_id, dept_name, mngr_id)
Manager(mngr_id, mngr_name)
Questions:
- Find the first names of employees whose names start with 'J' and contain at least 6 characters.
- Find the total number of employees in each department.
- List the department names managed by a manager named 'Brown'.
SQL queries:
a. SELECT first_name FROM Employee WHERE first_name LIKE 'J_____';b. SELECT first_name FROM Employee WHERE first_name LIKE 'J_____%';c. SELECT dept_id, COUNT(emp_id) FROM Employee GROUP BY emp_id;d. SELECT dept_id, COUNT(emp_id) FROM Employee GROUP BY dept_id;e. SELECT DISTINCT d.dept_name FROM Department d INNER JOIN Manager m ON d.mngr_id = m.mngr_id WHERE m.mngr_name = 'Brown';f. SELECT DISTINCT d.dept_name FROM Department d, Manager m WHERE d.mngr_id = m.mngr_id AND m.mngr_name = 'Brown';Match the correct SQL queries with the corresponding Questions.
1-a, 2-c, 3-f
1-b, 2-c, 3-e
1-a, 2-d, 3-e
1-b, 2-d, 3-f