在 SQL 中(让我们假设 ANSI 标准 SQL),是否可以从一个列中提取一个子字符串,基于另一个表,并将这个子字符串放入另一列?
例如,来自下表:
VISITS
name summary
---------------------------------------------
john visit to London
jack hotel in Paris with park visits
joe b&b in Paris with ice cream
james holidays in London and museums
jason visit in Milan and fashion tour
LOCATIONS
id name
-------------
1 Paris
2 London
3 Milan
4 Berlin
这个想法是从summary
列中提取位置并输出以下内容:
VISITS
name summary location
---------------------------------------------
john visit to London London
jack hotel in Paris with park visits Paris
joe b&b in Paris with ice cream Paris
james holidays in London and museums London
jason visit in Milan and fashion tour Milan