DP 2 1 Practice PDF
DP 2 1 Practice PDF
DP 2 1 Practice PDF
com/academy
Vocabulary
Identify the vocabulary word for each definition below.
Try It / Solve It
1. The manager of Global Fast Foods would like to send out coupons for the upcoming sale.
He wants to send one coupon to each household. Create the SELECT statement that
returns the customer last name and a mailing address.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
2
2. Each statement below has errors. Correct the errors and execute the query in Oracle
Application Express.
a.
SELECT first name
FROM f_staffs;
b.
SELECT first_name |" " | last_name AS "DJs on Demand Clients"
FROM d_clients;
c.
SELECT DISCTINCT f_order_lines
FROM quantity;
d.
SELECT order number
FROM f_orders;
3. Sue, Bob, and Monique were the employees of the month. Using the f_staffs table, create
a SELECT statement to display the results as shown in the Super Star chart.
Super Star
*** Sue *** Sue ***
*** Bob *** Bob ***
*** Monique *** Monique ***
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
3
5. Global Fast Foods has decided to give all staff members a 5% raise. Prepare a report that
presents the output as shown in the chart.
6. Create a query that will return the structure of the Oracle database EMPLOYEES table.
Which columns are marked “nullable”? What does this mean?
7. The owners of DJs on Demand would like a report of all items in their D_CDs table with
the following column headings: Inventory Item, CD Title, Music Producer, and Year
Purchased. Prepare this report.
10. There are four coding errors in this statement. Can you identify them?
SELECT employee_id, last_name
sal x 12 ANNUAL SALARY
FROM employees;
11. In the arithmetic expression salary*12 - 400, which operation will be evaluated first?
12. Which of the following can be used in the SELECT statement to return all columns of data
in the Global Fast Foods f_staffs table?
a. column names
b. *
c. DISTINCT id
d. both a and b
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
4
13. Using SQL to choose the columns in a table uses which capability?
a. selection
b. projection
c. partitioning
d. join
14. SELECT last_name AS "Employee". The column heading in the query result will appear
as:
a. EMPLOYEE
b. employee
c. Employee
d. "Employee:
16. Which statement below will return a list of employees in the following format?
Mr./Ms. Steven King is an employee of our company.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
5
18. Which queries will return three columns each with UPPERCASE column headings?
a. SELECT "Department_id", "Last_name", "First_name"
FROM employees;
b. SELECT DEPARTMENT_ID, LAST_NAME, FIRST_NAME
FROM employees;
c. SELECT department_id, last_name, first_name AS UPPER CASE
FROM employees
d. SELECT department_id, last_name, first_name
FROM employees;
20. Click on the History link at the bottom of the SQL Commands window. Scroll or use the
arrows at the bottom of the page to find the statement you wrote to solve problem 3
above. (The one with the column heading SuperStar). Click on the statement to load it
back into the command window. Execute the command again, just to make sure it is the
correct one that works. Once you know it works, click on the SAVE button in the top right
corner of the SQL Commands window, and enter a name for your saved statement. Use
your own initials and “_superstar.sql”, so if your initials are CT then the filename will be
CT_superstar.sql.
Log out of OAE, and log in again immediately. Navigate back to the SQL Commands win-
dow, click the Saved SQL link at the bottom of the page and load your saved SQL state-
ment into the Edit window. This is done by clicking on the script name. Edit the statement,
to make it display + instead of *. Run your amended statement and save it as ini-
tials_superplus.sql.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.