PL/SQL IN

The PL/SQL IN operator is used to compare a term of a condition with a list of fixed values.

IN example

 
SELECT * FROM course WHERE price IN (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

IN example

 
SELECT s.student_id, s.first_name, s.last_name, s.city 
FROM students s 
WHERE s.student_id IN (SELECT o.student_id FROM orders o WHERE o.student_id=s.student_id)
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