200 likes | 855 Views
INNER JOIN (EQUI-JOIN) Predicate. source tables. SELECT * FROM employee, department WHERE employee.DepartmentID = department.DepartmentID. is equivalent to. SELECT * FROM employee INNER JOIN department ON employee.DepartmentID = department.DepartmentID.
E N D
INNER JOIN (EQUI-JOIN) Predicate source tables SELECT * FROM employee, department WHERE employee.DepartmentID = department.DepartmentID is equivalent to SELECT * FROM employee INNERJOIN department ON employee.DepartmentID = department.DepartmentID or the same using another syntactic sugar SELECT Employee.lastName, DepartmentID, Department.DepartmentName FROM Employee INNERJOIN Department USING(DepartmentID); the result of employee department taken fromhttp://en.wikipedia.org/wiki/Join_(SQL)
NATURAL JOIN Predicate source tables SELECT * FROM employee NATURAL JOIN department the result taken fromhttp://en.wikipedia.org/wiki/Join_(SQL)
CROSS JOIN (CARTESIAN PRODUCT) Predicate source tables SELECT * FROM employee CROSS JOIN department is the same as implicit expression SELECT * FROM employee, department; the result of employee department … … … … taken fromhttp://en.wikipedia.org/wiki/Join_(SQL)
LEFT OUTER JOIN Predicate source tables SELECT * FROM employee LEFT OUTER JOIN department ON employee.DepartmentID = department.DepartmentID the result taken fromhttp://en.wikipedia.org/wiki/Join_(SQL)
RIGHT OUTER JOIN Predicate source tables SELECT * FROM employee RIGHT OUTER JOIN department ON employee.DepartmentID = department.DepartmentID the result taken fromhttp://en.wikipedia.org/wiki/Join_(SQL)
FULL OUTER JOIN Predicate source tables SELECT * FROM employee FULL OUTER JOIN department ON employee.DepartmentID = department.DepartmentID the result taken fromhttp://en.wikipedia.org/wiki/Join_(SQL)
THETA-JOIN (Θ-JOIN) Predicate Θ {< , > , = , , , } an example …. There is possible to define yet more abstract joins such as SEMI-JOIN, ANTI-JOIN etc. taken fromhttp://en.wikipedia.org/wiki/Join_(relational_algebra)#Joins_and_join-like_operators
RDM example – Doctor’s Office conceptual model of the problem possible relational implementation
Query example What are surnames and addresses of doctors having diagnosis alergy?