-- 若想要實現多表查詢 需要有連接條件
select employee.emp_id, name , total_sales
from employee , works_with
where employee.emp_id = works_with.emp_id ;
-- emp_id同時存在兩個表中,所以查詢語句中要表明是的是哪一個
-- 從SQL優化的角度來說,建議多表查詢時每個屬性前都要註明其所在的表
-- 可以給表格取別名 註明在from裡面 一旦用過別名就只能使用別名
select t1.emp_id, t1.name , t2.total_sales
from employee t1, works_with t2
where t1.emp_id= t2.emp_id ;