MySQL + SQL · Lesson 74
ANY and ALL Operators
ANY and ALL
ANY and ALL compare a value to a set of values from a subquery.
> ANY= greater than at least one.> ALL= greater than every one.
Examples
-- marks greater than ANY class-10 student (i.e. > the minimum)
SELECT name FROM students
WHERE marks > ANY (SELECT marks FROM students WHERE class = '10');
-- marks greater than ALL class-10 students (i.e. > the maximum)
SELECT name FROM students
WHERE marks > ALL (SELECT marks FROM students WHERE class = '10');
Summary
- > ANY = greater than the smallest in the set.
- > ALL = greater than the largest in the set.
💻 Live Code Editor
Is page ki language (MYSQL) mein code likhein aur turant chalाएं — yahीं, bina kuch install kiye.Powered by OneCompiler. Agar editor na khule to yahान naye tab mein kholein.
💻 Live Code Editor
Is page ke program yahan ready hain — chalाएं, badlें aur seekhें. Bina kuch install kiye.
Powered by OneCompiler. Editor mein code apne aap aa jata hai — Run dabaakर output dekhें.
Agar load na ho to naye tab mein kholें.