w1coding.comAll tutorials

SQL Leftjoin

SQL lessons
  1. Environment Setup
  2. Introduction
  3. Select
  4. Where
  5. Decision
  6. Insert
  7. Delete
  8. Distinct
  9. Limit
  10. Operator
  11. In
  12. Join
  13. Leftjoin
  14. Rightjoin
  15. Fulljoin
  16. Groupby
  17. Having
  18. Order
  19. Update

SQL LEFT JOIN

The LEFT JOIN clause returns all rows from the left table and matched rows from the right table. If no match is found, the result is NULL on the right side.

Example of LEFT JOIN

SELECT Users.first_name, Users.last_name, Orders.order_date
FROM Users
LEFT JOIN Orders ON Users.user_id = Orders.user_id;
    

This query retrieves the first and last names of users, along with their order dates (if available), including users with no orders.