Home > Database > Mysql Tutorial > SQL 必知必会笔记11创建高级联结

SQL 必知必会笔记11创建高级联结

WBOY
Release: 2016-06-07 17:39:16
Original
962 people have browsed it

1. 使用表别名 SQL 除了可以对列名和计算字段使用别名,还允许给表名起别名。这样 做有两个主要理由: 缩短SQL 语句; 允许在一条SELECT 语句中多次使用相同的表。 使用表别名示例: 1 SELECT cust_name, cust_contact 2 FROM Customers AS C, Orders AS O, O

1. 使用表别名

SQL 除了可以对列名和计算字段使用别名,还允许给表名起别名。这样 做有两个主要理由:

  • 缩短SQL 语句;
  • 允许在一条SELECT 语句中多次使用相同的表。
  • 使用表别名示例:

    1 SELECT cust_name, cust_contact 2 FROM Customers AS C, Orders AS O, OrderItems AS OI 3 WHERE C.cust_id = O.cust_id 4 AND OI.order_num = O.order_num ; ,

    Related labels:
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template