Explanation of SQL Join: Obtaining data from multiple tables using Join
For obtaining data from multiple tables in any database, we use join. Join is supported to most of the database. Including Oracle, MySQL, Microsoft SQL etc. supports joining. Using join all types of queries can be retrived from two or more tables of the database of Oracle, MySQL, Microsoft SQL etc. Generally, JOIN keyword is used in an SQL statement to query data from two or more tables, based on a relationship between certain columns in these tables. This page describes briefly about what is join, the syntax of join and types of join. Remember, join is the hardest part in Oracle and yuo need a clear conception regarding join. Without a clear concept, it's really difficult to be a master of any join of any type of database.
What is a Join?
A join is a data querying techniques from more than one table. Use a join to query data from more than one table.
Types of Join:
SQL Join are several types. Types of joins are the followings:
- Natural joins
- Cross joins
- Left outer joins
- Right outer joins
- Full outer joins
Synatax of SQL joins:
Lots of book and tutorials presents the syntax of joins into various fashions. Most of the time, people read the whole chapter of joins and learn all the categories of joins and learn the syntax. But after completing the full tutorial of joins, most people become so confuse which syntax is for which join. I also face the same problem, when I learned joins and learned the syntax. So, based on my own experience, I typed the syntax of joins like the followings:
SELECT table1.column, table2.column FROM table1 [NATURAL JOIN table2] | [JOIN table2 USING (column_name)] | [JOIN table2 ON (table1.column_name = table2.column_name)] | [LEFT | RIGHT | FULL OUTER JOIN table2 ON (table1.column_name = table2.column_name)] | [CROSS JOIN table2];
Explanation of the syntax of SQL joins
We perform the join syntax based on two tables: table1 and table2
table1 = indicates the name of the first table
table2 = indicates the name of the second table
column_name = indicates the name of the column
NATURAL JOIN = keywords for natural join
JOIN = keywords for eqijoin
LEFT OUTER JOIN = keywords of left outer join
RIGHT OUTER JOIN = keywords of right outer join
FULL OUTER JOIN = keywords of full outer join
JOIN table USING (column_name) = performs an equijoin based on the column name
JOIN table ON (table1.column_name = table2.column_name) = performs an equijoin based on the condition of ON clauses
LEFT | RIGHT | FULL OUTER JOIN = these keywords are used for each type of outer join
CROSS JOIN = keywords for Cartesian product of two tables
The tutorial Explanation of SQL Join: Obtaining data from multiple tables using Join supports any the SQL joining for any type of database including Oracle, Microsoft Database, MySQL database etc. A basic explanation of joining is explained briefly with proper joining syntax. Moreover, the types of joining are also mentioned.
More by this Author
Most of the IT farm's job interview or written exam has at least one question regarding OSI or TCP/IP model. Some questions of this topic are presented here with very concise answers. All these questions are very...
A list of default usernames and passwords for CISCO routers.
- 5How to Reset/Remove/Bypass a BIOS or CMOS Password? : A Complete Guide to Reset/Remove/Bypass BIOS or CMOS Password
User level passwords are used to restrict unauthorized access of a computer. BIOS or CMOS passwords are used to prevent access to BIOS settings or to prevent PC from booting. Thus BIOS passwords are used to add or...
No comments yet.