The PL/SQL ANY is used like comparison condition, must be preceded by =, !=, >, < , <=, >= and followed by a list or subquery.
ANY example
SELECT * FROM course WHERE price = ANY (10,20);
Output
| COURSE_ID | NAME | DESCRIPTION | DURATION | PRICE |
|---|---|---|---|---|
| 1 | SQL 1 | SQL course for beginners | 1 week | 10 |
| 3 | HTML5 | Learn HTML 5 | 1 week | 10 |
| 5 | CSS | Learn CSS | 2 week | 20 |
ANY example
SELECT s.student_id, s.first_name, s.last_name, s.city FROM students s WHERE s.student_id = ANY (SELECT o.student_id FROM orders o) ORDER BY s.student_id;
Output
| STUDENT_ID | FIRST_NAME | LAST_NAME | CITY |
|---|---|---|---|
| 4 | Emily | PETERSON | Phoenix |
| 5 | David | DAWSON | Seattle |
| 6 | Gabriel | LEWIS | Boston |
| 7 | Natalie | MARTIN | Baltimore |