home_work_5 part1
home_work_5 part1
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++use employees table which you have imported from employees.csv
file+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++
1. Write a query to display the names (first_name, last_name) using alias name
"First Name", "Last Name".
3. Write a query to get all employee details from the employee table order by first
name, descending.
4. Write a query to get the names (first_name, last_name), salary, PF of all the
employees (PF is calculated as 15% of salary).
5. Write a query to get the employee ID, names (first_name, last_name), salary in
ascending order of salary.
7. Write a query to get the maximum and minimum salary from employees table.
8. Write a query to get the average salary and number of employees in the employees
table.
9. Write a query to get the number of employees working with the company.
10. Write a query to get the number of jobs available in the employees table.
11. Write a query get all first name from employees table in upper case.
12. Write a query to get the first 3 characters of first name from employees table.
select first_name from employees order by first_name limit 3;
+------------+
| first_name |
+------------+
| Adam |
| Alana |
| Alberto |
+------------+
3 rows in set (0.01 sec)
select (171*214)+625;
+---------------+
| (171*214)+625 |
+---------------+
| 37219 |
+---------------+
1 row in set (0.00 sec)
14. Write a query to get the names (for example Ellen Abel, Sundar Ande etc.) of
all the employees from employees table.
15. Write a query to get first name from employees table after removing white
spaces from both side.
16. Write a query to get the length of the employee names (first_name, last_name)
from employees table.
17. Write a query to check if the first_name fields of the employees table contains
numbers.
19. Write a query to get monthly salary (round 2 decimal places) of each and every
employee
Note : Assume the salary field provides the 'annual salary' information.
=====================================================================
1. Write a query to display the name (first_name, last_name) and salary for all
employees whose salary is not in the range $10,000 through $15,000.
4. Write a query to display the name (first_name, last_name) and hire date for all
employees who were hired in 1987.
5. Write a query to display the first_name of all employees who have both "b" and
"c" in their first name.
select first_name from employees where first_name like '%b%' and first_name like
'%c%';
6. Write a query to display the last name, job, and salary for all employees whose
job is that of a Programmer or a Shipping Clerk, and whose salary is not equal to
$4,500, $10,000, or $15,000.
select last_name,job_id,salary from employees where job_id
in('it_prog','sh_clerk') and salary !=1500;
7. Write a query to display the last name of employees whose names have exactly 6
characters.
8. Write a query to display the last name of employees having 'e' as the third
character.
10. Write a query to display the name (first_name, last_name), salary and PF (15%
of salary) of all employees.
11. Write a query to select all record from employees where last name in 'BLAKE',
'SCOTT', 'KING' and 'FORD'.
___________________________________________________________________________________
_______________________________________________
1. Write a query to list the number of jobs available in the employees table.
5. Write a query to get the average salary and number of employees working the
department 90.
6. Write a query to get the highest, lowest, sum, and average salary of all
employees.
7. Write a query to get the number of employees with the same job.
8. Write a query to get the difference between the highest and lowest salaries.
9. Write a query to find the manager ID and the salary of the lowest-paid employee
for that manager.
10. Write a query to get the department ID and the total salary payable in each
department.
11. Write a query to get the average salary for each job ID excluding programmer.
12. Write a query to get the total salary, maximum, minimum, average salary of
employees (job ID wise), for department ID 90 only.
13. Write a query to get the job ID and maximum salary of the employees where
maximum salary is greater than or equal to $4000.
14. Write a query to get the average salary for all departments employing more than
10 employees.