1.
Examine the data in the EMPLOYEES and EMP_HIST tables:
EMPLOYEES
NAME DEPT_ID MGR_ID JOB_ID SALARY
EMPLOYEE_ID
101 Smith 20 120 SA_REP 4000
102 Martin 10 105 CLERK 2500
103 Chris 20 120 IT_ADMIN 4200
104 John 30 108 HR_CLERK 2500
105 Diana 30 108 IT_ADMIN 5000
106 Smith 40 110 AD_ASST 3000
108 Jennifer 30 110 HR_DIR 6500
110 Bob 40 EX_DIR 8000
120 Ravi 20 110 SA_DIR 6500
EMP HIST
EMPLOYEE_ID NAME JOB_ID SALARY
101 Smith SA_CLERK 2000
103 Chris IT_CLERK 2200
104 John HR_CLERK 2000
106 Smith AD_ASST 3000
108 Jennifer HR_MGR 4500
The EMP_HIST table is updated at the end of every year. The employee ID, name, job ID, and salary of each
existing employee are modified with the latest data. New employee details are added to the table.
Which statement accomplishes this task?
2.
Examine the data of the EMPLOYEES table.
EMPLOYEES (EMPLOYEE_ID is the primary key. MGR_ID is the ID of managers and refers to the
EMPLOYEE_ID)
EMP_NAME DEPT_ID MGR_ID JOB_ID SALARY
EMPLOYEE_ID
101 Smith 20 120 SA_REP 4000
102 Martin 10 105 CLERK 2500
103 Chris 20 120 IT_ADMIN 4200
104 John 30 108 HR_CLERK 2500
105 Diana 30 108 HR_MGR 5000
106 Bryan 40 110 AD_ASST 3000
108 Jennifer 30 110 HR_DIR 6500
110 Bob 40 EX_DIR 8000
120 Ravi 20 110 SA_DIR 6500
Evaluate this SQL statement:
SELECT e.employee_id "Emp_id", e.emp_name "Employee", e.salary,
3.
You added a PHONE_NUMBER column of NUMBER data type to an existing EMPLOYEES table. The
EMPLOYEES table already contains records of 100 employees. Now, you want to enter the phone numbers of
each of the 100 employees into the table.
Some of the employees may not have a phone number available.
Which data manipulation operation do you perform?
4.
In which case would you use a FULL OUTER JOIN?
5.
What is necessary for your query on an existing view to execute successfully?
6.
The EMP table has these columns:
ENAME VARCHAR2(35)
SALARY NUMBER(8,2)
HIRE_DATE DATE
Management wants a list of names of employees who have been with the company for more than five years.
Which SQL statement displays the required results?
7.
Examine the data in the EMPLOYEES table.
EMPLOYEES
EMP_NAME DEPT_ID MGR_ID JOB_ID SALARY
EMPLOYEE_ID
101 Smith 20 120 SA_REP 4000
102 Martin 10 105 CLERK 2500
103 Chris 20 120 IT_ADMIN 4200
104 John 30 108 HR_CLERK 2500
105 Diana 30 108 IT_ADMIN 5000
106 Smith 40 110 AD.ASST 3000
108 Jennifer 30 110 HR_DIR 6500
110 Bob 40 EK_DIR 8000
120 Revi 20 110 SA_DIR 6500
On the EMPLOYEES table, EMPLOYEE_ID is the primary key. MGR_ID is the ID of managers and refers to the
EMPLOYEE_ID. The JOB_ID column is a NOT NULL column.
Evaluate this DELETE statement:
DELETE employee_id, salary, job_id
FROM employees
WHERE dept_id = 90;
Why does the DELETE statement fail when you execute it?
8.
Evaluate these two SQL statements:
SELECT last_name, salary , hire_date
FROM EMPLOYEES
ORDER BY salary DESC;
SELECT last_name, salary, hire_date
FROM EMPLOYEES
ORDER BY 2 DESC;
What is true about them?
9.
You would like to display the system date in the format "Monday, 01 June, 2001".
Which SELECT statement should you use?
10.
The CUSTOMERS table has these columns:
CUSTOMER_ID NUMBER(4) NOT NULL
CUSTOMER_NAME VARCHAR2(100) NOT NULL
STREET_ADDRESS VARCHAR2(150)
CITY_ADDRESS VARCHAR2(50)
STATE_ADDRESS VARCHAR2(50)
PROVINCE_ADDRESS VARCHAR2(50)
COUNTRY_ADDRESS VARCHAR2(50)
POSTAL_CODE VARCHAR2(12)
CUSTOMER_PHONE VARCHAR2(20)
Which statement finds the rows in the CUSTOMERS table that do not have a postal code?