Professional Documents
Culture Documents
Rhino Adame-11ictmasipag - q3 Pt4
Rhino Adame-11ictmasipag - q3 Pt4
Department of Education
REGION I
SCHOOLS DIVISION OF CANDON CITY
CANDON NATIONAL HIGH SCHOOL
ORACLE DATABASE
PERFORMANCE TASK 4
You work as a database programmer at Oracle Corporation. The HR department needs your assistance in creating
some queries. Using the EMPLOYEES table, create the SQL statements to retrieve the data needed by the HR
department. Each query will be graded using the rubric below.
Points Description
5 Query is correct and complete. Query produces the correct results.
4 Query is mostly correct but has few missing components. Query executes without any syntax errors but
output is incomplete.
3 Query is somewhat correct but incomplete. Query may not execute due to a syntax error but it can be
easily corrected.
2 Query is incorrect. Query does not execute due to many syntax errors.
1 Query is incomplete. Query only contains the SELECT and FROM clauses.
0 No answer.
Sample Report:
HIREDATE
Sample Report:
Dream Salaries
3. Display the last name, first name, hire date, and day of the week on which the employee started. Label the column
DAY.
SELECT LAST_NAME, FIRST_NAME, HIRE_DATE, TO_CHAR(hire_date, 'DAY') as "DAY"
FROM HR.employees;
Sample Report:
LAST_NA FIRST_NAM HIRE_DAT
ME E E DAY
4. Create a query that displays the first name, last name and commission amount of all employees whose first name
starts with ‘L’. If an employee does not earn commission, show “No Commission.” Label the column COMM.
Sample Report:
FIRST_NAM LAST_NA
E ME COMM
5. Using CASE syntax, write a query that displays the grade of all employees based on the value of the JOB_ID
column, using the following data:
Job Grade
AD_PRES A
ST_MAN B
IT_PROG C
None of the above 0
SELECT JOB_ID, decode (JOB_ID,
'AD_PRES', 'A',
'ST_MAN', 'B',
'IT_PROG', 'C',
'0')GRADE
FROM HR.employees;
Sample Report:
GRAD
JOB_ID E
AC_ACCOU
0
NT
AD_ASST 0
AD_PRES A
6. Rewrite the statement in the preceding exercise by using the CASE syntax.
SELECT JOB_ID, CASE JOB_ID
WHEN 'AD_PRES' THEN 'A'
WHEN 'ST_MAN' THEN 'B'
WHEN 'IT_PROG' THEN 'C'
ELSE '0' END GRADE
FROM HR.employees;
Sample Report:
GRAD
JOB_ID E
AC_ACCOU
0
NT
AC_MGR 0
AD_ASST 0
AD_PRES A