Asked By
randulf
0 points
N/A
Posted on - 11/08/2011
Hello and Good Day!
Please list the types of Joins that are used in SQL, Oracle and MYSQL and their advantages and uses. I would also like to know in detail about a scenario in which Right and Left joins are used in the same query.
Is it possible?
Thank you…
Answered By
akmzaki
0 points
N/A
#107503
MySQL, SQL and Oracle problem
SQL, Oracle and MYSQL have many types of Joins which are following.
-
Cross joins: Cross joins are those joins with no join condition. Every row of single table is shared with every row of other one table. The outcome is referred to as a Cartesian product.
-
Inner joins: These are regular joins. An inner join returns those rows that suit the join condition. Every row returned by an inner join includes data from every single table implicated in the join.
-
Outer joins: Outer joins are an addition to inner joins. An outer join returns the rows that suit the join condition and also the rows from that single table for which no corresponding rows (i.e., that suit the join condition) live in the other table. Outer joins further divided into three parts depend on the table or tables. Left outer joins, right outer joins and full outer joins are subcategory of outer joins. Left and right pass on to the tow sides of JOIN keyword. Outer joins syntax is like this
-
FROM table1 {LEFT | RIGHT | FULL} [OUTER] JOIN table2
-
Equi- andnon-equi-joins: To relate the rows of dual tables an Equi- join use the equal operator (=) and to relate the rows of dual tables a non-equi join use operators other than equal operator.
-
Self-join: A self join is a join of a table to itself.
-
In the FROM class the LEFT and RIGHT keywords in an outer join query are similar to the place of tables. The similar outcome can be accomplished by utilizing LEFT OUTER JOIN or RIGHT OUTER JOIN by control the place of the tables. For Instance, the tow next queries are equal:
-
SELECT d.dept_id, d.name, l.regional_group
-
FROM department d LEFT OUTER JOIN location l
-
ON d.location_id = l.location_id;
-
SELECT d.dept_id, d.name, l.regional_group
-
FROM location l RIGHT OUTER JOIN department d
-
ON d.location_id = l.location_id;
The other table is then the optional table in the join.
In every aspect, LEFT or RIGHT directional word point out in the direction of anchor table, table that is requisite. Then the other one table is the optional table in join
Answered By
rahul84
0 points
N/A
#107504
MySQL, SQL and Oracle problem
There are four joins , 1 inner join 2 outer join 3 left outer join 4 right outer join .
Joins used to join two different tables ,so that we can take result in a single query .
thanks