Saturday, March 25, 2006

SECTION 3 LESSON 2
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.

----select d_packages.code,d_events.name
from d_packages, d_events
where d_events.cost between d_packages.low_range and d_packages.high_range;

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.

----select e.last_name,e.salary,j.grade_level
from employees e,job_grades j
where e.salary between j.lowest_sal and highest_sal;

3. What condition requires creation of a nonequijoin?

----There is no exact match between the two columns in each table.

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?

----Working with lengthy column and table names can be cumbersome. Fortunately, there is a way to shorten the syntax using aliases. To distinguish columns that have identical names but reside in different tables, use column aliases.

6. What is the purpose of the WHERE clause in a join?

----Don't need to list all information of the tables, only the information that will be used.

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

----nonequijoin

8. What kind of join would you use if you wanted to join two tables on any rows that have the same name and the same data type.

----equijoin

1 Comments:

Blogger skye said...

Query and display manager ID, department ID, department name,first name,and last name for all employees in departments 80,90,110, and 190. ??? Need help please

10:09 AM  

Post a Comment

<< Home