๐ฐ ๐ฆ๐ค๐ ๐ท๐ผ๐ถ๐ป๐ ๐ฒ๐๐ฒ๐ฟ๐ ๐๐ผ๐ณ๐๐๐ฎ๐ฟ๐ฒ ๐ฒ๐ป๐ด๐ถ๐ป๐ฒ๐ฒ๐ฟ ๐๐ต๐ผ๐๐น๐ฑ ๐ธ๐ป๐ผ๐.
๐น INNER JOIN
Returns only the records that have matching values in both the left and right tables.
๐น LEFT (OUTER) JOIN
Returns all records from the left table and the matched records from the right table. If no match is found, NULL values are returned for columns from the right table.
๐น RIGHT (OUTER) JOIN
Returns all records from the right table and the matched records from the left table. If no match is found, NULL values are returned for columns from the left table.
๐น FULL (OUTER) JOIN
Retrieves all records from the left and right tables, showing matched records where possible. For unmatched records, it includes NULLs in the columns from the table without a match.
In practice, INNER JOIN and LEFT JOIN tend to be the most frequently used.
INNER JOIN is ideal for retrieving matching data from both tables, while LEFT JOIN ensures that all records from the left table are included, even if there are no matches in the right table.
Pro tip: Ensure that the columns used in join conditions are properly indexed. This can significantly enhance the performance of your queries by allowing the database to quickly locate and retrieve the matching rows.
Subscribe to my newsletter
Read articles from PRADEEP VP directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by