Sql 我需要使用哪个连接?

Sql 我需要使用哪个连接?,sql,join,outer-join,Sql,Join,Outer Join,问题:我知道我需要使用两个表 我需要找到书名上有“运动”字样的书、杂志、传单 Example Table Library1: books, magazines etc,... title Example Table Library2: flyers, etc (THIS TABLE DOES NOT HAVE title column anywhere) Psuedocode:从标题为“%sport%”的两个表中选择书籍、杂志和传单; 我需要任何与“运动”相匹配的结果,并显示它是否是一本书、杂

问题:我知道我需要使用两个表

我需要找到书名上有“运动”字样的书、杂志、传单

Example Table Library1: books, magazines etc,... title
Example Table Library2: flyers, etc (THIS TABLE DOES NOT HAVE title column anywhere)
Psuedocode:从标题为“%sport%”的两个表中选择书籍、杂志和传单; 我需要任何与“运动”相匹配的结果,并显示它是否是一本书、杂志或任何东西

不确定是否需要左联接、联接或外部联接


这个的语法是什么?

都不是。你需要一个工会。例如:

select title, 'book' as product from books where title like '%sport%'
union all
select title, 'magazine' from magazines where title like '%sport%'
union all
select title, 'flyer' from flyers where title like '%sport%'

都不是。你需要一个工会。例如:

select title, 'book' as product from books where title like '%sport%'
union all
select title, 'magazine' from magazines where title like '%sport%'
union all
select title, 'flyer' from flyers where title like '%sport%'

都不是。你需要一个工会。例如:

select title, 'book' as product from books where title like '%sport%'
union all
select title, 'magazine' from magazines where title like '%sport%'
union all
select title, 'flyer' from flyers where title like '%sport%'

都不是。你需要一个工会。例如:

select title, 'book' as product from books where title like '%sport%'
union all
select title, 'magazine' from magazines where title like '%sport%'
union all
select title, 'flyer' from flyers where title like '%sport%'
此表的任何位置都没有出现问题的标题列。您不能使用
UNION
,因为
UNION
必须在每个
UNION
中具有相同的列,如果在表2中没有标题,您将使用哪个字段搜索
SPORT
?此表没有出现问题的标题列。您不能使用
UNION
,因为
UNION
必须在每个
UNION
中具有相同的列,如果在表2中没有标题,您将使用哪个字段搜索
SPORT
?此表没有出现问题的标题列。您不能使用
UNION
,因为
UNION
必须在每个
UNION
中具有相同的列,如果在表2中没有标题,您将使用哪个字段搜索
SPORT
?此表没有出现问题的标题列。您不能
UNION
,因为
UNION
必须在每个
UNION
中具有相同的列,如果在表2中没有标题,您将使用哪个字段搜索
SPORT