Chapter 7 Flashcards
What is a Join?
A relational operation that causes two or more tables with a common domain to be combined into a single table or view.
What is Equi-join?
A join in which the joining condition is based on equality between values in the common columns; common columns appear redundantly in the result table
What is Natural join?
An equi-join in which one of the duplicate columns is eliminated in the result table.
What are usually the common columns in joined tables?
Usually the primary key of the dominant table and the foreign key of the dependent table in 1:M relationships.
What is Outer join?
A join in which rows that do not have matching values in common columns are nonetheless included in the result table (as opposed to inner join, in which rows must have matching values in order to appear in the result table)
What is Union join?
Includes all data from each table that was joined
Example of different join types
What is a subquery?
Placing an inner query (SELECT statement) inside an outer query
What are the options for using a subquery?
- In a conditon of the WHERE clause
- As a “table” of the FROM clause
- Within the HAVING clause
What are the two options for a subquerie?
Noncorrelated
Correlated
What is a noncorrelated subquerie?
Executed once for the entire outer query
What is a correlated subquerie?
Executed once for each row returned by the outer query
What are the traits of a noncorrelated subquerie?
- Do not depend on data from the outer query
- Execute once for the entire outer query
What are the traits of a correlated subquerie?
- Make use of data from the outer query
- Execute once for each row of the outer query
- Can use the EXISTS operator
What is a union querie?
Combine the output (union of multiple queries) together into a single result table