๐Ÿฐ ๐—ฆ๐—ค๐—Ÿ ๐—ท๐—ผ๐—ถ๐—ป๐˜€ ๐—ฒ๐˜ƒ๐—ฒ๐—ฟ๐˜† ๐˜€๐—ผ๐—ณ๐˜๐˜„๐—ฎ๐—ฟ๐—ฒ ๐—ฒ๐—ป๐—ด๐—ถ๐—ป๐—ฒ๐—ฒ๐—ฟ ๐˜€๐—ต๐—ผ๐˜‚๐—น๐—ฑ ๐—ธ๐—ป๐—ผ๐˜„.

PRADEEP VPPRADEEP VP
1 min read

๐Ÿ”น 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.

0
Subscribe to my newsletter

Read articles from PRADEEP VP directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

PRADEEP VP
PRADEEP VP