Assignment 3CC
-
Upload
9897856218 -
Category
Documents
-
view
215 -
download
0
Transcript of Assignment 3CC
-
7/28/2019 Assignment 3CC
1/2
ASSIGNMENT-3 OF DBMS
Queries based on emp & dept provided by oracle
1. List ename whose commission is NULL.
2. Display the employee last_name concatenated with first_name, the length
of the employee last_name , & the numeric position of the letter a inemployee last name for all the employees who have the string REP
contained in the jobid starting at the fourth position of the job id.
3. Calculate the remainder of a salary after it is divided by 5000 for all
employees whose job title is sales_rep.
4. Display the employee number, hiredate, number of months employed, six
month review date, first Friday after hire date and last day of the
hiremonth for all employees for fewer than 36 months.
5. Compare the hire date for all employees who stated in 1997. Display the
employee number, hire date & start month using the round & trunk
functions.
6. Display the names & hiredate of all the employees who joined on May
24,1999.
7. To find employees hired before 1990.
8. For each employee, display the employee number, last_name & salary
increased by 15% & expresses as a whole number.
9. Modify the above query to add a column that subtracts the old salary
from the new salary. List the column Increase.
10. Write a query that display the employees last names with the first letter
capitalized & all other letters lowercase & length of the names for all
employees whose name stats with J, A or M. Also sort the results by
employees last name.11. Display the employees last name & calculate the number of months
between today & date the employee was hired. Label this column as
months_worked. Round the number of months to nearest whole number.
12. Write a query that produces the following for each employees
earns monthly but wants . Label the column as Dream Salary.
13. Create a query to display the last name & salary for all employees.
Format the salary to be 15 characters long, left padded with $. Label the
column Salary.
14. Display each employee last name, hire date & salary review date which is
the first Monday after six months of service. Label the column REVIEW.Format the dates to appear in the format similar to Monday, the Thirty-
first of july,2000.
15. Display each employee last name, hire date & day of the week on which
the employee started. Order the results y the day of the week .
16. Create a query that display the employees last name & comm. Amounts.
If an employee does not earn commission put, No commission.
17. Using the decode function, write a query that display the grade of all
employees based on the column job_id as per following data:
Job Grade
AD_PRES A
ST_MAN BIT_PROG C
-
7/28/2019 Assignment 3CC
2/2
SA_REP D
ST_CLERK E
None of the above 0
18. Write the above query using Case syntax
19. To calculate the annual compensation of all the employees, for this we
need to multiply the monthly salary by 12 & then add commissionpercentage to it.
20. Create a query to display all the employees who were hired before 1990.
21. Create a query to check whether employees last name & first name are
equal in length.