0% found this document useful (0 votes)
14 views

SQL 2nd Assignment

Uploaded by

yash sontakke
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)
14 views

SQL 2nd Assignment

Uploaded by

yash sontakke
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

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 employees from employee 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 employees from employee where employee
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 employees from employee where 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 * from employee order by salary desc;
5. Write a query to get average salary of all the employees
Write your query here
Select avg(salary) from employee;

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


Write your query here
Select * from employee order by salary desc limit 5;
7. Write a query to get the average salary of each department.
Write your query here
Select department, avg(salary) from employee group by department;
8. Write a query to get the minimum salary of each department.
Write your query here
Select department, min(salary) from employee group by department;
9. Write a query to get the minimum salary of each department.
Write your query here
Select department, min(salary) from employee 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

You might also like