SQL JOIN:-
SQL join and type of join |
SQL join clause is used to combine rows from the two or more tables or joins in SQL are used to retrieve data from two or more related tables.In general tables are related to each other using foreign key constraint.
In SQL there are different types of joins
- Inner join
- Outer join
- Cross join
1.Inner join:-
Inner join keywords select the records that have matching in both the table.
2.Outer join:-
Outer join keywords select records that does not have match in both the table.
3.Cross join:-
Cross join is join of tables without specifying of join condition the query would return all possible combination of the tables in the SQL query.
EXAMPLE:-
- Order table
1.Order table |
- Customer Table
2.Customer table |
Query:-
SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate
FROM Orders
JOIN Customers ON Orders.CustomerID=Customers.CustomerID;
FROM Orders
JOIN Customers ON Orders.CustomerID=Customers.CustomerID;
No comments:
Post a Comment