Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- polynomial regression
- train/test
- variables
- Else
- machine learning
- start exercise
- matplotlib
- Text Analytics
- For loops
- self parameter
- continue
- PROJECT
- break
- error
- multiple lines
- line color
- data distribution
- pie charts
- matplotlib.pyplot
- line width
- __init__
- iterates
- PANDAS
- SQL
- Default X points
- MySQL
- Python
- Text mining
- Github
- AS
Archives
- Today
- Total
Data Science Explorer
[Basic Grammar] SQL LEFT JOIN 본문
반응형
The LEFT JOIN returns all records from the left table (table 1). In other words, if there is no match with table 2, the result is 0 records from the right side.
- Syntax
SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name = table2.column_name;
Example
SELECT Brands.BrandName, Orders.OrderID
FROM Brands
LEFT JOIN Orders ON Brands.BrandsID = Orders.OrderID
ORDER BY Brands.BrandName;
Exercises
Write an SQL query to retrieve a list of all employees and their respective departments. Use a LEFT JOIN to include employees who may not yet be assigned to a department.
SELECT Employees.EmployeeName, Department.DepartmentName
FROM Employees
LEFT JOIN Departments ON Employees.DepartmentID = Departments.DepartmentID;
'SQL' 카테고리의 다른 글
[Basic Grammar] SQL FULL OUTER JOIN (0) | 2023.10.18 |
---|---|
[Basic Grammar] SQL RIGHT JOIN (0) | 2023.10.18 |
[Basic Grammar] SQL INNER JOIN (0) | 2023.10.18 |
[Basic Grammar] SQL Aliases (0) | 2023.10.17 |
[Basic Grammar] SQL BETWEEN Operator (0) | 2023.10.16 |