select 检查列是否不包含提供的数组中的值
select to check if a column does not contain a value in a provided array
我想 select 检查我的字符串数组中是否有任何国家不包含在 psql 数据库的国家 table 中。
因此我有一个国家名称列表 ARRAY['Country1','country2'.....]
并且我有一个 table 国家,我想查询 select 个不在我将提供给 where 子句的字符串中的国家
像这样
SELECT name from country where name not in (ARRAY['Country1','country2'.....])
你快到了:
SELECT name
from country
where name <> ALL (ARRAY['Country1','country2'.....])
我想 select 检查我的字符串数组中是否有任何国家不包含在 psql 数据库的国家 table 中。
因此我有一个国家名称列表 ARRAY['Country1','country2'.....]
并且我有一个 table 国家,我想查询 select 个不在我将提供给 where 子句的字符串中的国家
像这样
SELECT name from country where name not in (ARRAY['Country1','country2'.....])
你快到了:
SELECT name
from country
where name <> ALL (ARRAY['Country1','country2'.....])