219k views
3 votes
How to get unmatched records from left table in sql

User Efsandino
by
7.9k points

1 Answer

6 votes

Final answer:

To get unmatched records from the left table in SQL, use a LEFT JOIN combined with a WHERE clause to check for NULL values in the right table.

Step-by-step explanation:

To get unmatched records from the left table in SQL, you can use a LEFT JOIN combined with a WHERE clause. The LEFT JOIN returns all rows from the left table and the matching rows from the right table. By adding a WHERE condition to check for NULL values in the right table, you can obtain the unmatched records. Here's an example:

SELECT left_table.column_name FROM left_table LEFT JOIN right_table ON left_table.key_column = right_table.key_column WHERE right_table.key_column IS NULL;
User Denns
by
8.1k points