Junior — Middle
What type of table join do you use to get information about the user even if related records are missing?
sobes.tech AI
Answer from AI
To obtain information about a user, even if related records in another table are absent, a LEFT JOIN (left join) is used. It returns all records from the left table (for example, the users table) and the matching records from the right table, and if there are no matches, the fields from the right table will be NULL.
Example SQL query:
SELECT users.id, users.name, orders.order_date
FROM users
LEFT JOIN orders ON users.id = orders.user_id;
This example will show all users, including those who have no orders.