18.Oracle数据库SQL开发之 使用表别名
欢迎转载,转载请标明出处:http://blog.csdn.net/notbaron/article/details/49107201
在使用如下命令查询时候
select products.name,product_types.namefrom products,product_types whereproducts.product_type_id=product_types.product_type_id andproducts.product_id=3;
多次输入了表的名字,是一项冗余劳动,开始使用表的别名来降低工作量。
如下图:
SQL>select p.name,pt.name from products p,product_types pt wherep.product_type_id=pt.product_type_id order by p.name;
NAME NAME
------------------------------ ----------
2412: The Return Video
Chemistry Book
Classical Music CD
Creative Yell CD
From Another Planet DVD
Modern Science Book
Pop 3 CD
Space Force 9 DVD
Supernova Video
Tank War Video
Z Files Video
11 rows selected.