Oracle SQL/PLSQL Section 1.2: SQL Query

 Oracle SQL/PLSQL  Section 1.2: SQL Query


List employees earning more than $50000 born this century. List their name, date of birth and salary, sorted alphabetically by name.


 SELECT employee_name, date_of_birth, salary
 FROM
   employees
 WHERE  salary > 50000
 AND date_of_birth >= DATE '2000-01-01'
 ORDER BY employee_name;


Show the number of employees in each department with at least 5 employees. List the largest departments first.


 SELECT department_id, COUNT(*)
 FROM
   employees
 GROUP BY department_id
 HAVING COUNT(*) >= 5
 ORDER BY COUNT(*) DESC;



Post a Comment

0 Comments