IN

The IN function tests whether the specified value is found in one or more expressions.

IN Syntax

Use the following syntax when incorporating the IN function in queries:

IN(test_value, expression1 [,...])

Where test_value is the value to test to see if it exists in any of the expressions that you specify.

IN Examples

The example queries in this section run against the AnzoGraph sample Tickit data set, which captures sales activity for a fictional Tickit website where people buy and sell tickets for sporting events, shows, and concerts. You can load and explore this data set. For more information, see Working with the Tickit Data.

The example below queries the sample Tickit data set to return the names of people who were born in the year 1975.

SELECT ?birthday (concat(?fname, ?lname) AS ?name)
FROM <tickit>
WHERE {
  ?s <firstname> ?fname .
  ?s <lastname> ?lname .
  ?s <birthday> ?birthday.
  FILTER ((YEAR(?birthday)) IN (1975))
}
birthday   | name
-----------+-----------------
1975-08-05 | BlakeMcgowan
1975-11-10 | BlakeRandall
1975-09-24 | SolomonMassey
1975-03-14 | FallonGaines
1975-08-04 | MadonnaClark
1975-11-21 | MalikGibbs
1975-12-16 | GiacomoHiggins
...
779 rows