Does SQLite support ALL and ANY keywords?
I keep facing syntax error while using them.
SELECT name, price
FROM products
WHERE price > ALL (
SELECT price FROM products WHERE category = 'Electronics'
);`
I can get what I want using a different approach. I want to know can I use ALL or ANY.
I tried using ALL to get name and price of the products that have a higher price than all products with category 'Electronics'.
Does SQLite support ALL and ANY keywords?
I keep facing syntax error while using them.
SELECT name, price
FROM products
WHERE price > ALL (
SELECT price FROM products WHERE category = 'Electronics'
);`
I can get what I want using a different approach. I want to know can I use ALL or ANY.
I tried using ALL to get name and price of the products that have a higher price than all products with category 'Electronics'.
Share Improve this question edited Jan 12 at 8:55 samhita 4,1252 gold badges11 silver badges18 bronze badges asked Nov 18, 2024 at 12:41 daniialdaniial 91 bronze badge 3- 1 This question is similar to: SQLite syntax for "ALL". If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. – Tim Biegeleisen Commented Nov 18, 2024 at 12:45
- 1 When you look at the list of supported functions in the SQLite documentation, do you see those functions? If not, then they're not supported. – Guy Incognito Commented Nov 18, 2024 at 12:47
- I see ALL but I get syntax error while I try to use it. I even check it with chatgpt and I get error again – daniial Commented Nov 18, 2024 at 12:48
1 Answer
Reset to default 0SQLite does not directly support the ALL
and ANY
keywords.
While SQLite does have an ALL keyword, it's used in a different context, specifically for selecting all rows from a table. It's not used in comparison operations like in other SQL dialects.
you can achieve similar functionality like you used (>
).
SELECT * FROM table1
WHERE column1 > (SELECT MAX(column1) FROM table2);