#SQL #Join #BigQuery


Example:
Import the CSV UTF-8 tables, in this example (CUSTOMERS) and (ORDERS), into BigQuery.


Add the two tables in a dataset (SALES) of the project (myprojectjoin11022026):

Write a Query with a LEFT JOIN

o and c are alias for ORDERS and SALES tables.
Select the desired fields with a LEFT JOIN to obtain

A LEFT JOIN means:
Return all rows from the ORDERS table.
Include data from CUSTOMERS only if a matching record exists.
If no match exists → the fields from table c are NULL.

The key is the Customer_ID. This Left join includes all customer_IDs from the Order table (1, 2, 5) and doesn’t include (null) customer_ID #4 from the Customers table as it is not a match.
Leave a Reply