Skip to content
C

Ever Enrolled

Easysql
Learn the Concept: UNION

Write a query returning every distinct student_id who was enrolled in 2025, 2026, or both, ordered ascending.

sql
CREATE TABLE enrolled_2025 (student_id INTEGER NOT NULL); CREATE TABLE enrolled_2026 (student_id INTEGER NOT NULL);

Sample data:

sql
INSERT INTO enrolled_2025 (student_id) VALUES (1), (2), (3), (4); INSERT INTO enrolled_2026 (student_id) VALUES (2), (3), (5);

Related Problems

Input (stdin)

Output

Run your code to see output here...