A.5. Chapter 5

  1. Add a clause to the WHERE condition to make the following query return only the department names without employees:

    select employee_id "Emp ID", last_name || ', ' ||
      first_name "Name", department_name "Dept"
    from employees e,departments d
    where e.department_id(+) = d.department_id;

    Answer: The following clause added to the WHERE condition makes the query return only department names without employees:

    and employee_id is null

  2. A type of query that has either too few or no join conditions is known as a ___________ query.

    Answer: Cartesian product

  3. Name three kinds of equijoins.

    Answer: Inner joins, self-joins, left outer joins, right outer joins, and full outer joins are all examples of equijoins.

  4. A natural join makes what assumption between the columns of two or more tables to be joined?

    Answer: A natural join assumes that the tables are to be joined on the columns that have the same names and datatypes.

  5. The Oracle9i syntax moves the join conditions from the _________ clause to the ________ clause in a SELECT statement.

    Answer: WHERE, FROM

  6. To avoid a Cartesian product, a query with four tables must have at least how many join conditions between tables?

    Answer: A query with four tables must have at least three join conditions to avoid a Cartesian product.

  7. To return all the rows in one table regardless of whether any rows in another table match on the join condition, you would use what kind of a join?

    Answer: An outer join returns all rows in one table regardless of whether any rows in another table match on the join condition.

  8. What is the symbol used to signify an outer join in a pre-Oracle9i query?

    Answer: A (+) is used to signify an outer join in a pre-Oracle9i query.

  9. A full outer join uses what SQL set operator in a pre-Oracle9i database query?

    Answer: A full outer join uses the UNION set operator in a pre-Oracle9i query.

  10. A primary key in one table would frequently be joined to what in a second table?

    Answer: A primary key in one table would frequently be joined to a foreign key in a second table.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset