31271 Lecture Notes - Lecture 8: Foreign Key, Unique Key
Lecture 8: SQL II
Join
• Join is a relational operation that causes two or more tables with a common
column to be combined into a single table or view. It displays the output from
these tables by finding matching row values in columns that have the same data
type.
• Common columns in joined tables are usually the primary key of the dominant
table, and the foreign key of the dependent table in 1:M relationships.
Join Type – Equi-join
• An equi-join (or inner join) is one in which the joining condition is based on
equality between values in the common columns.
• Inner join will only return rows from each table that have matching rows in the
other.
Join Type – Natural join
• An equi-join in which one of the duplicate columns Is eliminated in the results
table, and no joining condition is specified.
• Code is similar to equi-join, however replaces the keyword with NATURAL
JOIN and eliminates the condition.
Join Type – Cross Join
• Asfa
Join Type – Outer Join
• A join in which rows that do not have matching values in common columns are
nonetheless included in the result table.
find more resources at oneclass.com
find more resources at oneclass.com
Document Summary
Join is a relational operation that causes two or more tables with a common column to be combined into a single table or view. Join type equi-join: an equi-join (or inner join) is one in which the joining condition is based on equality between values in the common columns. Inner join will only return rows from each table that have matching rows in the other. Join type cross join: asfa table, and no joining condition is specified, an equi-join in which one of the duplicate columns is eliminated in the results, code is similar to equi-join, however replaces the keyword with (cid:498)natural. Join type outer join: a join in which rows that do not have matching values in common columns are nonetheless included in the result table. Includes all columns from each table, and an instance for each row of each table with matching records from both sides where available.