I have an array of string say it is ["a1","a2","a3"] and want to pass this array into the query.
The purpose is not to select the elements from database that are in this array or not in this, but is to select the elements in this array that are not inside the database.
Assume there is a table that is
create table table1(
id int primary key not null,
name text
);
in side the table1, it may have [1,"a1"],[2,"a2"],[3, "b3"],[11,"str2"],[14,"california"],[15,"US"],[16,"aus"]
when I pass the array ["a1","a2","a3"] into the query, it could find that element "a3" is not inside table1 as "a1" and "a2" can be found, but "a3" cannot.
I have thought a possible solution to write in sql but it seems I cannot write out the query
My thought is
select [something] from [an array](/*this is something I passed from java or golang*/)
where [something] not in (select column from a table)
My thought is that select column from a table is a collection and an array is also a collection, but when writing into query, I stuck at there
I just wonder whether it is possible that I could organise the query and leave the place as a "?" and if I pass that array into ?, it will find the elements that are inside the array, but not inside the table.