C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
SQL LEFT JOINThe SQL left join returns all the values from the left table and it also includes matching values from right table, if there are no matching join value it returns NULL. BASIC SYNTAX FOR LEFT JOIN: SELECT table1.column1, table2.column2.... FROM table1 LEFTJOIN table2 ON table1.column_field = table2.column_field; let us take two tables in this example to elaborate all the things: CUSTOMER TABLE:
This is second table ORDER TABLE:
join these two tables with LEFT JOIN: SQL SELECT ID, NAME, AMOUNT,DATE FROM CUSTOMER LEFT JOIN ORDER ON CUSTOMER.ID = ORDER.CUSTOMER_ID; This will produce the following result:
Next TopicSQL Right Join
|