Home > Database > Mysql Tutorial > body text

MySQL创建高级联结_MySQL

WBOY
Release: 2016-06-01 13:01:47
Original
1374 people have browsed it

SQL允许给表取别名,这样做的两个主要理由是:

缩短SQL语句;允许在单条SELECT语句中多次使用同一个表;与之前相对应的我们使用别名来表示一个表:

\

自联结

问题:假如知道某一厂商生产的一个产品 ID 为 DTNTR有问题,需要从数据库中查找出该厂商生产的其他所有产品。

下面的SELECT语句可以将该vend_id所生产的所有产品查找出来:

\

现在来看使用联结的相同查询:

\

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