簡單的2張表演示
1.左連線
SELECT CustomerPro.ID,CustomerPro.CustomerName,Employee.EmployeeName
FROM CustomerPro
LEFT JOIN Employee
on CustomerPro.EmployeeID=Employee.ID
2.右連線
SELECT CustomerPro.ID,CustomerPro.CustomerName,Employee.EmployeeName
FROM CustomerPro
RIGHT JOIN Employee
on CustomerPro.EmployeeID=Employee.ID
3.內連線
SELECT CustomerPro.ID,CustomerPro.CustomerName,Employee.EmployeeName FROM CustomerPro,Employee WHERE CustomerPro.EmployeeID=Employee.ID 這2種其實都是內連線的寫法 SELECT CustomerPro.ID,CustomerPro.CustomerName,Employee.EmployeeName FROM CustomerPro inner JOIN Employee on CustomerPro.EmployeeID=Employee.ID