SQL is a special-purpose programming language designed for managing information in a relational database management system (RDBMS). The word relational here is key; it specifies that the database management system is organised in such a way that there are clear relations defined between different sets of data. Join makes relational database systems relational.
Joins allow you to link data from two or more tables together into a single query result--from one single SELECT statement.
.When combining rows from multiple tables in one query, you need to use the JOIN command. There are a few different types of joins, and the following should help explain the differences between them.
The syntax will vary depending on which database type you are using. In this course i have used Oracle database.
The JOIN operations, which are among the possible Table Expressions in a FROM clause, perform joins between two tables.
Below is a brief description of the various types of joins used in Oracle.
- INNER JOIN operation
- Specifies a join between two tables with an explicit join clause.
- LEFT OUTER JOIN operation
- Specifies a join between two tables with an explicit join clause, preserving unmatched rows from the first table.
- RIGHT OUTER JOIN operation
- Specifies a join between two tables with an explicit join clause, preserving unmatched rows from the second table.
- CROSS JOIN operation
- Specifies a join that produces the Cartesian product of two tables. It has no explicit join clause.
- NATURAL JOIN operation
- Specifies an inner or outer join between two tables. It has no explicit join clause. Instead, one is created implicitly using the common columns from the two tables.
In all cases, you can specify additional restrictions on one or both of the tables being joined in outer join clauses or in the WHERE clause.
In this course there will be lots of hands-on real world examples of SQL table joins.