假设我有两个表如下所示:
学生
age|name|gender
---+----+------
3 |jon | M
4 |mike| M
2 |Sue | F
师:
experience|name|college
----------+----+-------
10 years |Sue | UVA
23 years |Tom | Yale
9 years |Bob | Harvard
在执行外部联接时,如何在识别Sue Teacher和Sue Student之间的差异的同时组合此表?
答案 0 :(得分:0)
您的意思是UNION
而不是外部联接吗?
SELECT 'student' as type, name
FROM student
UNION SELECT 'teacher' as type, name
FROM teacher