SQL语法新手学生

sam*_*all 2 sql syntax alias

描述以下SQL查询的输出:

select custId, name
from customer
where region = "New York"
UNION 
select cust.custId, cust.name
from customer cust
where cust.custId IN (select cust_order.custId
from customer_order cust_order, company_employee comp_emp
where cust_order.salesEmpId = comp_emp.empId
AND comp_emp.name = 'DANIEL');
Run Code Online (Sandbox Code Playgroud)

我的问题是:在包含from customer cust'cust'的行中引用customer表中的列?

这是一个家庭作业问题我已经确定了导致这一行的组件,我认为cust是客户表中的一栏......如果我走在正确的轨道上,我不是要求整体解决方案只是一点鼓励...

Chr*_*ris 5

cust是Customer表的别名.所以不用写customer.custId,你可以写cust.custId