In this video of code decode we have explained about joins in mysql which is very important
in terms of interview prepration
Udemy Course of Code Decode on Microservice k8s AWS CICD link:
[ Ссылка ]
Course Description Video :
[ Ссылка ]
Kickstart your career in Full Stack Development with OdinSchool's Bootcamp. Apply today!
Registration Link : [ Ссылка ]
What are Joins and What are different types of joins in SQL?
SQL joins are used to retrieve data from multiple tables into a meaningful result set. It is performed whenever you need to fetch records from two or more tables. They are used with SELECT statement and join conditions.
Following are the different types of joins used in SQL:
INNER JOIN
SELF JOIN
LEFT OUTER JOIN
RIGHT OUTER JOIN
FULL OUTER JOIN
CROSS JOIN
What is INNER JOIN in SQL?
Inner join returns only those records from the tables that match the specified condition and hides other rows and columns.
it fetches rows when there is at least one match of rows between the tables is found.
INNER JOIN keyword joins the matching records from two tables.
It is assumed as a default join, so it is optional to use the INNER keyword with the query.
Syntax : SELECT column_lists FROM table1 INNER JOIN table2 ON join_condition1 INNER JOIN table3 ON join_condition2
What is the Right JOIN in SQL?
The Right join is used to retrieve all rows from the right-hand table and only those rows from the other table that fulfilled the join condition.
It returns all the rows from the right-hand side table even though there are no matches in the left-hand side table.
If it finds unmatched records from the left side table, it returns a Null value.
This join is also known as Right Outer Join.
Syntax : SELECT colum_lists FROM table1 RIGHT JOIN table2 ON join_condition;
What is Left Join in SQL?
The Left Join is used to fetch all rows from the left-hand table and common records between the specified tables.
It returns all the rows from the left-hand side table even though there are no matches on the right-hand side table.
If it will not find any matching record from the right side table, then it returns null.
This join can also be called a Left Outer Join.
Syntax : SELECT colum_lists FROM table1 LEFT JOIN table2 ON join_condition;
What is Full Join in SQL?
The Full Join results from a combination of both left and right join that contains all the records from both tables.
It fetches rows when there are matching rows in any one of the tables.
This means it returns all the rows from the left-hand side table and all the rows from the right-hand side tables.
If a match is not found, it puts NULL value. It is also known as FULL OUTER JOIN.
Syntax : SELECT * FROM table1 FULL OUTER JOIN table2 ON join_condition;
What is CROSS JOIN?
If we use the cross join to combine two different tables, then we will get the Cartesian product of the sets of rows from the joined table.
When each row of the first table is combined with each row from the second table, it is known as Cartesian join or cross join.
After performing the cross join operation, the total number of rows present in the final table will be equal to the product of the number of rows present in table 1 and the number of rows present in table 2.
SELECT * FROM TableName1 CROSS JOIN TableName2
SELECT * FROM TableName1 , TableName2
Most Asked Core Java Interview Questions and Answers: [ Ссылка ]
Advance Java Interview Questions and Answers: [ Ссылка ]
Java 8 Interview Questions and Answers: [ Ссылка ]
Hibernate Interview Questions and Answers:
[ Ссылка ]
Spring Boot Interview Questions and Answers:
[ Ссылка ]
Angular Playlist: [ Ссылка ]
SQL Playlist: [ Ссылка ]
GIT: [ Ссылка ]
Subscriber and Follow Code Decode
Subscriber Code Decode: [ Ссылка ]
LinkedIn : [ Ссылка ]
Instagram: [ Ссылка ]
#joinsinSql #sql #codedecode
![](https://s2.save4k.ru/pic/u21ewlSTvkg/maxresdefault.jpg)