表别名的使用

select  cust_name,cust_contact
from customers as c,orders as o,orderitems as oi
where c.cust_id = o.cust_id
  and oi.order_num = o.order_num
  and prod_id = 'tnt2';

上语句中 customers as c 建立c作为customers的别名,别名不仅可以使用在where子句中,还可以用于select的列表,order 不要子句,以及语句的其它部分,应该注意的是表别名只在查询执行中使用,与列别名不一样,表别名不返回客户机

posted @ 2013-11-27 01:30  long896130895  阅读(251)  评论(0编辑  收藏  举报