最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

sql - Does SQLite support ALL and ANY keywords? - Stack Overflow

matteradmin5PV0评论

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
Add a comment  | 

1 Answer 1

Reset to default 0

SQLite 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);
Post a comment

comment list (0)

  1. No comments so far