Database Programming With SQL 7-2: Oracle Nonequijoins and Outer Joins Practice Activities

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

academy.oracle.

com

Database Programming with SQL


7-2: Oracle Nonequijoins and Outer Joins
Practice Activities
Objectives
• Construct and execute a SELECT statement to access data from more than one table
using a nonequijoin
• Create and execute a SELECT statement to access data from more than one table us-
ing an Oracle outer join

Try It / Solve It
1. Create a join based on the cost of the event between the DJs on Demand tables
D_EVENTS and D_PACKAGES. Show the name of the event and the code for each
event.

2. Using the Oracle database, create a query that returns the employee last name, salary,
and job-grade level based on the salary. Select the salary between the lowest and highest
salaries.

3. What condition requires the creation of a nonequijoin?

4. Rewrite the following nonequijoin statement using the logical condition operators (AND,
OR, NOT): WHERE a.ranking BETWEEN g.lowest_rank AND g.highest_rank

5. How do you know when to use a table alias and when not to use a table alias?

6. What kind of join would you use if you wanted to find data between a range of numbers?

7. You need to produce a report for Global Fast Foods showing customers and orders. A
customer must be included on the report even if the customer has had no orders.

Copyright © 2019, 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

8. Create a query of the Oracle database that shows employee last names, department IDs,
and department names. Include all employees even if they are not assigned to a
department.

9. Modify the query in problem 8 to return all the department IDs even if no employees are
assigned to them.

10. There are one or more errors in each of the following statements. Describe the errors and
correct them.

a. WHERE e.department_id(+) = d.department_id (+);

b. SELECT e.employee id, e. last name, d. location id


FROM employees, departments
WHERE e.department_id = d.department_id(+);

11. Create a query that will show all CD titles and song IDs in the DJs on Demand database
even if there is no CD number in the track-listings table.

12. How many times has someone asked you: “What do you want to be when you grow up?”
For most of us, the first thing that comes to mind is something like business manager,
engineer, teacher, game designer, doctor, scientist, computer programmer, or accountant -
- all pretty much traditional career choices. Have you ever thought about working in an odd
job or nontraditional career? There are people who are professional shoppers for busy
executives, directors of zoos, recipe designers, insecticide chemists, golf-course
designers, and turf managers. Picture yourself in a dream job or nontraditional career
doing something that you think would be interesting, life fulfilling, and profitable.

Use Internet resources to explore your idea. Write a brief description of the job to share
with the class.

Copyright © 2019, 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.

You might also like