SQL Employee Data Queries Assignment Answers
Your question:
Answer the following questions in Oracle Live SQL using HR schema tables, Using the Employees Table 1. Retrieve all the employees who got salary more than 2000$ 2. Retrieve all the employees who got salary in the range 2000$ to 11000 S 3. Retrieve all the employees who got salary out of the range 2000$ to 11000$ 4. Retrieve all the employees who got salary 2000$,10500$ or 17000$ using the IN operator 5. Retrieve all the employees who got salary other than 2000 \$, 10500$ or 17000 S using the IN operator 6. Retrieve employee Full name along with the department name. 7. Retrieve the first name, last name, department id and salary for all employees who is working in department no. 50 sorted by their salary in descending order. 8. Retrieve the first name, last name, department id, and the city in which they work. 9. Display the maximum and minimum salary values. 10. For each department, display the department id along with how many employees working in it, the maximum and minimum salaries.
Assignment Help Answers with Step-by-Step Explanation:
Here are the SQL queries to achieve the tasks using the HR schema's Employees table in Oracle Live SQL:
2. Retrieve all the employees who got a salary in the range $2000 to $11000:
SELECT *
FROM employees
WHERE salary NOT BETWEEN 2000 AND 11000;
5. Retrieve all the employees who got a salary other than $2000, $10500, or $17000 using the IN operator:
SELECT *
FROM employees e
JOIN departments d ON e.department_id = d.department_id;
ORDER BY salary DESC;
8. Retrieve the first name, last name, department id, and the city in which they work:
9. Display the maximum and minimum salary values:
SELECT MAX(salary) AS "Maximum Salary", MIN(salary) AS "Minimum Salary"
FROM employees e
JOIN departments d ON e.department_id = d.department_id


