Philadelphia University Faculty Of Administrative & Financial Sciences

advertisement
Philadelphia University
Faculty Of Administrative & Financial Sciences
Business Networking and Systems Management Department
Database Management Systems /0371240
Home Work Number (1)
1) Display employee names, job, salary of all employees work as salesman or
president and their salary is more than 1500 $ .
2-Display the employee names which there names contain two A.
3-Disply the name and job title of all employees how do not have a manager.
4-Query the table emp by using an SQL comparison operator to display the
names of employees those there hiredate is in the range from 10/02/1981 to
17/11/1981, they work as manager or salesman and there salary between 1300
to 2500.
5-Display ename and commission of employees with commission less than or
equal 30% from there salaries
6-Create a query that displays the employees name and indicates the amounts
of their salaries through asterisks. Each asterisk signifies a hundred dollars.
Sort the data in descending order of salary. Label the column
EMPLOYEE_AND_THEIR_SALARIES.
7-Display the employee name, job and salary for all employees whose job is clerks
and their salary is not equal to 1000, 3000, 5000.
8. Display the names of the employees whose there manager
number can be divide over 3.
9. Display ename for all employees who work at the same department with martin
(without taking the department number from the emp table)
10. Create a query that displays the employees name and indicates the amounts of their
salaries
through asterisks. Each asterisk signifies a hundred dollars. Sort the data
in
descending
order
of
salary.
Label
the
column
EMPLOYEE_AND_THEIR_SALARIES.
)1(
11. Determine the EMPLOYEE SALARY after cutting the tax rate for each employee,
tax_rate based upon the monthly salary.
Monthly Salary Range
Rate
$
0.00 - 999.99
0%
$1,000.00 - 1,999.99
9%
$2,000.00 - 2,999.99
20%
$3,000.00 - 3,999.99
30%
$4,000.00 - 4,999.99
40%
$5,000.00 - 5,999.99
42%
$6,000.00 - 6,999.99
44%
$7,000.00 or greater
45%
12. Query the emp and salgrade tables, to display ename, salary, and grade for all
employees there hiredate between 10/10/1980 and 30/10/1982 . using emp table
and salgrade table.
13. Query the emp table, to display all employees name job along with there
managers name for all employees who earn more than 1500.
14. Query the emp and dept tables using simple join to display the names of
employees, department name and location .
15. Query the emp and salgrade tables, to display ename, salary, and grade for
all employees along with there managers names, salary, and grades.
16. Query the emp and dept tables using to display the names of employees, and there
managers department name for the employees and there managers and location of
the department.
17.display the minimum, maximum, sum, and average
salary for each job type in emp table, label the columns
MAXIMUM, MINIMUM, SUM, and AVERAGE
respectively.
Output:
JOB
MAXIMUM MINIMUM
SUM
AVERAGE
--------- --------- --------- ----------------ANALYST
3000
3000
6000
3000
CLERK
1300
800
4150
1037.5
MANAGER
2975
2450
8275
2758.3333
PRESIDENT 5000
5000
5000
5000
)2(
SALESMAN
1600
1250
5600
1400
18.using group functions, query the table emp to return the
number of rows that have a Null commission.
Output:
COUNT)*(
--------10
19.Write a query to display the department name, location
name, number of employees, and the
average salary
for all employees in that department. Label the columns
dname, loc,
Number of People, and Salary,
respectively.
output:
20. Using the Having clause display the job title and minimum salary for jobs, with
minimum salary less than 2000 from the table emp;
Output:
21. Query the table dept by using a group function to find number of departments in
the cities having a letter A in their names, displaying the location and the
department numbers.
)3(
OUTPUT
LOC
------------CHICAGO
DALLAS
COUNT(DNAME)
-----------1
1
22. Display the employees name who’s their salaries greater than the average salaries.
OUTPUT
23. Display department number and the average salary for each department for all the
departments that have average salary more than the average salary for department
30.
OUTPUT:
24. Display the job that has the minimum average salary.
OUTPUT:
25. Display the employees; number and Job for the employees whose salary is greater
than any clerk and who are works as manager.
OUTPUT:
)4(
26. display the employee name and salary of all employees whose manager is
‘KING’;
OUTPUT:
27. Find the min salary in the department that locates in NEW YORK .
28. Write SQL query to find the employee new salary, by decoding the salary. If the
salary between 0.0 and 999.0 then the new salary will equal the original salary plus 10%,
If the salary between 1000 and 1999.0 then the new salary will equal the original salary
plus 15%, If the salary between 2000 and 2999.0 then the new salary will equal the
original salary plus 20%, for all other employees, there is no increase in salary.
)5(
Download