1.
Examine the data in the EMPLOYEES and DEPARTMENTS tables.
EMPLOYEES
LAST_NAME DEPARTMENT_ID SALARY
Getz 10 3000
Davis 20 1500
Bill 20 2200
Davis 30 5000
Kochhar 5000
DEPARTMENTS
DEPARTMENT_ID DEPARTMENT_NAME
10 Sales
20 Marketing
30 Accounts
40 Administration
You want to retrieve all employees, whether or not they have matching departments in the departments table.
Which query would you use?
2.
You need to give the MANAGER role the ability to select from, insert into, and modify existing rows in the
STUDENT_GRADES table. Anyone given this MANAGER role should be able to pass those privileges on to
others.
Which statement accomplishes this?
3.
The database administrator of your company created a public synonym called HR for the
HUMAN_RESOURCES table of the GENERAL schema, because many users frequently use this table. As a
user of the database, you created a table called HR in your schema. What happens when you execute this
query?
SELECT *
FROM HR;
4.
Examine the description of the EMPLOYEES table:
EMP_ID NUMBER(4) NOT NULL
LAST_NAME VARCHAR2(30) NOT NULL
FIRST_NAME VARCHAR2(30)
DEPT_ID NUMBER(2)
JOB_CAT VARCHARD2(30)
SALARY NUMBER(8,2)
Which statement shows the maximum salary paid in each job category of each department?
5.
Management has asked you to calculate the value 12*salary* commission_pct for all the employees in the EMP
table. The EMP table contains these columns:
LAST NAME VARCNAR2(35) NOT NULL
SALARY NUMBER(9,2) NOT NULL
COMMISION_PCT NUMBER(4,2)
Which statement ensures that a value is displayed in the calculated columns for all employees?
6.
Which syntax turns an existing constraint on?
7.
The EMPLOYEE tables has these columns:
LAST_NAME VARCHAR2(35)
SALARY NUMBER(8,2)
COMMISSION_PCT NUMBER(5,2)
You want to display the name and annual salary multiplied by the commission_pct for all employees. For
records that have a NULL commission_pct, a zero must be displayed against the calculated column.
Which SQL statement displays the desired results?
8.
Examine the data from the ORDERS and CUSTOMERS table.
ORDERS
ORD_ID ORD_DATE CUST_ID ORD_TOTAL
100 12-JAN-2000 15 10000
09-MAR-
101 40 8000
09-MAR-
102 35 12500
15-MAR-
103 15 12000
104 25-JUN-2000 15 6000
105 18-JUL-2000 20 5000
106 18-JUL-2000 35 7000
107 21-JUL-2000 20 6500
04-AUG-
108 10 8000
CUSTOMERS
CUST_ID CUST_NAME CITY
10 Smith Los Angeles
15 Bob San Francisco
20 Martin Chicago
25 Mary New York
30 Rina Chicago
35 Smith New York
40 Linda New York
Which SQL statement retrieves the order ID, customer ID, and order total for the orders that are placed on the
same day that Martin places his orders?
9.
You need to modify the STUDENTS table to add a primary key on the STUDENT_ID column. The table is
currently empty.
Which statement accomplishes this task?
10.
Evaluate the SQL statement:
1 SELECT a.emp_name, a.sal, a.dept_id, b.maxsal
2 FROM employees a,
3 (SELECT dept_id, MAX(sal) maxsal
4. FROM employees
5 GROUP BY dept_id) b
6 WHERE a.dept_id = b.dept_id
7 AND a. asl < b. maxsal;
What is the result of the statement?