49.5k views
3 votes
How would NOT IN be used to find all US cities in states other than New York and New Jersey?

a) FILTER(?state NOT IN ("New York", "New Jersey"))
b) FILTER(?city NOT IN ("New York", "New Jersey"))
c) FILTER(?city IN ("New York", "New Jersey"))
d) NOT IN cannot be used in this context.

1 Answer

6 votes

Final answer:

The correct answer is b) FILTER(?city NOT IN ("New York", "New Jersey")).

Step-by-step explanation:

The correct answer is b) FILTER(?city NOT IN ("New York", "New Jersey")).

The NOT IN keyword is used in a query to exclude specific values from a result set based on a condition. In this case, we want to find all US cities in states other than New York and New Jersey. By using FILTER(?city NOT IN ("New York", "New Jersey")), we are filtering out any cities that are either New York or New Jersey, leaving us with the desired result.

User Will Barnwell
by
7.9k points

No related questions found