SQL Stands For Structured Query Language Which Is Used To Managing Data in Relational Database Management Systems
SQL Stands For Structured Query Language Which Is Used To Managing Data in Relational Database Management Systems
b) select * from teacher CROSS JOIN school;will have 1st teacher row with all school row
and then 2 teacher row than all school rows
2. Inner Join: Inner join creates a new result table by combining column values of two
tables (A and B) based upon the join-predicate.
The result of the join can be defined as the outcome of first taking the Cartesian product (or
Cross join) of all records in the tables (combining every record in table A with every record
in table B)then return all records which satisfy the join predicate. This can include
duplicate data from another table for corresponding matching condition in first table.
3. Equi Join: An equi-join is a specific type of comparator-based join, that uses only
equality comparisons in the join-predicate. Using other comparison operators (such as <)
disqualifies a join as an equi-join.
Above query of inner join can be used in this example also as those have = inthem.
If columns in an equi-join have the same name, an optional shorthand notation for
expressing equi-joins, by way of the USING construct: Select * FROM teacher INNER JOIN
school USING (SectionID);
Any columns mentioned in the USING list will appear only once, with an unqualified name,
rather than once for each table in the join
"1. Inner join can have equality (=) and other operators (like <,>,<>) in the join condition.
2. Equi join only have equality (=) operator in the join condition.
3. Equi join can be an Inner join, Left Outer join, Right Outer join
4. The USING clause is not supported by SQL Server and Sybase. This clause is supported
by Oracle and MySQL."
4.Outer Join:An outer join does not require each record in the two joined tables to have a
matching record. The joined table retains each recordeven if no other matching record
exists. Outer joins subdivide further into left outer joins, right outer joins, and full outer
joins, depending on which table's rows are retained (left, right, or both).
a)Left Outer Join:The result of a left outer join (or simply left join) for table A and B
always contains all records of the "left" table (A), even if the join-condition does not find
any matching record in the "right" table (B)
SELECT * FROM teacher LEFT OUTER JOIN school ON teacher.SectionID = school.SectionID;
b)Right Outer Join:A right outer join (or right join) closely resembles a left outer join,
except with the treatment of the tables reversed. Every row from the "right" table (B) will
appear in the joined table at least once. If no matching row from the "left" table (A) exists,
NULL will appear in columns from A for those records that have no match in B.
SELECT * FROM teacher Right OUTER JOIN school ON teacher.SectionID = school.SectionID;
5. Natural Join:A natural join is a type of equi-join where the join predicate arises
implicitly by comparing all columns in both tables that have the same column-names in the
joined tables. The resulting joined table contains only one column for each pair of equally
named columns.