SQL LEFT JOIN

LEFT JOIN

It will fetch all rows from left table and matched records from right table.

Some time we need to fetch all records from left table with matching records from right table,in this case we use keyword LEFT JOIN .

Example: “users” Table:

userIduserNameemail
1psnippetpsnippet@gmail.com
2gauravgaurav@gmail.com
3Johnjohn@gmail.com

“products” Table:

productIdproductNameuserId
1My product1
2Iphone X3

SQL QUERY:

Output:

userIduserNameproductName
1psnippetMy Product
2gauravnull
3johnIphone X

Cheers 🙂

Gaurav Kumar

Hi, my name is Gaurav Kumar and I specialize in the Computer Software industry. I have been working as a Software Developer, and it's my passion to learn new things and sharing what I've learned.

Leave a Reply

Your email address will not be published. Required fields are marked *