what is join?
Ans: A Sql join statement are used to combine data and rows between two or more tables bases on command field between them.
Mainly Four Types of Joins
1. Inner join
2. Left join
3. right join
4. full join
Inner join: Matching row between two tables.
What is Self Join:
A self JOIN is a regular join, but the table is joined with itself.
Example:
Ans: A Sql join statement are used to combine data and rows between two or more tables bases on command field between them.
Mainly Four Types of Joins
1. Inner join
2. Left join
3. right join
4. full join
Inner join: Matching row between two tables.
SELECT table1.column1,table1.column2,table2.column1,.... FROM table1 INNER JOIN table2 ON table1.matching_column = table2.matching_column; table1: First table. table2: Second table matching_column: Column common to both the tables.
What is Self Join:
A self JOIN is a regular join, but the table is joined with itself.
Example:
Well, one classic example is where you wanted to get a list of employees and their immediate managers:
select e.employee as employee, b.employee as boss
from emptable e, emptable b
where e.manager_id = b.empolyee_id
order by 1
It's basically used where there is any relationship between rows stored in the same table.
- employees.
- multi-level marketing.
- machine parts.
No comments:
Post a Comment