0% found this document useful (0 votes)
8 views2 pages

Project 2

PROJECT 2

Uploaded by

rrjangra440
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Project 2

PROJECT 2

Uploaded by

rrjangra440
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

SELECT Employee_name, Department, Salary FROM Employee WHERE Salary

BETWEEN 13000 AND 17000;Answer the given questions:

1. Write a query to get the Employees from the Employee table created in the previous
assignment having a salary between 13000 and 17000.
Write your query here
SELECT Employee_name, Department, Salary
FROM employee_data
WHERE Salary BETWEEN 13000 AND 17000;
2. Write a query to get data of employee1, Employee7, Employee10 and Employee15
From the “Employees” table.
Write your query here
SELECT Employee_name, Department, Salary
FROM employee_data
WHERE Employee_name IN ('Employee1', 'Employee7', 'Employee10',
'Employee15');

3. Write a query to get the data of Employees whose name starts with “J” .
Write your query here
SELECT Employee_name, Department, Salary
FROM employee_data
WHERE Employee_name LIKE 'J%';

4. Write a query to order the employee table according to the salaries from high to low
Write your query here
SELECT Employee_name, Department, Salary FROM employee_data
ORDER BY Salary DESC;
5. Write a query to get average salary of all the employees
Write your query here
SELECT AVG(Salary) AS Average_Salary
FROM employee_data;

6. Write a query to get 5 highest paid employees only.


Write your query here
SELECT Employee_name, Department, Salary
FROM employee_data
ORDER BY Salary DESC
LIMIT 5;
7. Write a query to get the average salary of each department.
Write your query here
8. Write a query to get the minimum salary of each department.
Write your query here
SELECT Department, min(Salary) AS minimum_Salary
FROM employee_data
GROUP BY Department;
9. Write a query to get the minimum salary of each department.
Write your query here
SELECT Department, min(Salary) AS minimum_Salary
FROM employee_data
GROUP BY Department;

10. Write a query to group the employees into the low paid(<15000), decently paid(15000-
20000) and high paid (>20000)employees according to their salary.
a. Write your query here
SELECT Employee_name, Department, Salary, CASE WHEN Salary < 15000
THEN 'Low Paid' WHEN Salary BETWEEN 15000 AND 20000 THEN 'Decently
Paid' ELSE 'High Paid' END AS Salary_Category FROM Employee;

You might also like