针对相同的表进行的连接被称为“自连接”(self join)
面向对象语言以对象的方式来描述世界,而面向集合语言SQL以集合(eg.二维表) 的方式来描述世界
可重排列、排列、组合
-
有序对(ordered pair)
<1, 2> ≠ <2, 1> - 排列 -
无序对(unordered pair)
{1, 2} = {2, 1} - 组合
-- 用于获取可重排列的SQL语句
select p1.name as name_1,p2.name as name_2
from Products p1,Products p2;
-- 用于获取排列的SQL语句
select p1.name as name_1,p2.name as name_2
from Products p1,Products p2
where p1.name<>p2.name;
-- 用于获取组合的SQL语句
select p1.name as name_1,p2.name as name_2
from Products p1,Products p2
where p1.name>p2.name;
-- 用于获取组合的SQL语句:扩展成3列
select p1.name as</