Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

CNC314 DATABASE Fall 23.

24
QUIZ (Model D)

1. Find the error and correct.

Display the last name concatenated with the job ID, separated by
a comma and space, and name the column Employee and Title.

SELECT last_name|| , job_id "Employee and Title"

FROM employees;

SELECT last_name||', '||job_id "Employee and Title" FROM


employees;

2. Complete the code.

Display the last name and department number of all employees in


departments 20 and 50 in alphabe+cal order by name.

SELECT last_name, department_id

FROM employees

WHERE department_id IN (20, 50)

ORDER BY last_name;

3. Display the manager’s number and the salary of the lowest


paid employee for that manager. Exclude anyone whose
manager is not known. Exclude any groups where the minimum
salary is less than $10,000. Sort the output in Ascending order
of salary.
CNC314 DATABASE Fall 23.24
QUIZ (Model D)
SELECT manager_id, MIN(salary)
FROM employees
WHERE manager_id IS NOT NULL
GROUP BY manager_id
HAVING MIN(salary) > 10000
ORDER BY MIN(salary) ASC;

You might also like