'Is it possible to make lists using WITH clause in SQLite?

Say I have a list of items A, B, C, D, E which are not present in a table but are hard-coded. can we create a list of sorts using with statement? Something like

WITH listname1 AS (item1, item2, item3,...)
SELECT x from table_x where x in listname1


Solution 1:[1]

You can use the VALUES clause inside the cte like this:

WITH listname1 AS (VALUES ('item1'), ('item2'), ('item3'))
SELECT x from table_x where x in listname1;

See a simplified demo.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 forpas