MySQL Joins
Joins are used to combine the data from two or more tables based the below joins type.
1. Inner join
2. Left Join
3. Right Join
4. Cross Join
1. Inner Join: It shows, matched records from both the tables.
Syntax:
select * from table1_name inner join table2_name on table1_name.col_name=table2_name.col_name;
2. Left Join: It shows, matched records from both the tables and all the records from left table.
Syntax:
select * from table1_name left join table2_name on table1_name.col_name=table2_name.col_name;
3. Right Join: It shows, matched records from both the tables and all the records from right table.
Syntax:
select * from table1_name right join table2_name on table1_name.col_name=table2_name.col_name;
4. Cross join: It shows the result of all the combination of two tables that means it combine each row of one table with each row of another table.
select * from table_name1 cross join table_name2;
Comments
Post a Comment