query processing and data analysis

Click here to load reader

Post on 16-Apr-2017

178 views

Category:

Software

0 download

Embed Size (px)

TRANSCRIPT

PowerPoint PresentationWhat is a Join?
A join is a collection of data from multiple tables.
It combines two or more tables to retrieve data from multiple tables.
The primary keys and foreign keys are used to join related tables to one another.
*Property of STI
Equijoins or Inner Joins
The equijoin or inner join combines two tables with a common column which is usually the primary key.
Syntax:
Example:
The natural join removes duplicate columns in the joining columns.
Syntax:
Non-equijoins
It combines two or more tables based on a specified column value not equaling a specified column value in another table.
Syntax:
Outer Joins
It produces all rows that exist in one table, even if there are corresponding rows do not exist in the joined table.
The left outer join preserves every row in the left-hand table.
The right outer join preserves every row in the right-hand table.
A full outer join, preserves all rows from both tables.
*Property of STI
TABLE2 ON TABLE1.COLUMN_NAME = TABLE2.COLUMN_NAME
SALARY_TBL ON EMPLOYEE_TBL.EMP_ID = SALARY_TBL.EMP_ID;
Syntax:
WHERE A.COLUMN_NAME = B.COLUMN_NAME
[ AND A.COLUMN_NAME = C.COLUMN_NAME ]
*Property of STI
Cross Joins
It returns all possible combinations of rows from the two tables.
Syntax:
SELECT *
Example:
SELECT *
*Property of STI