Skip to content
C

Union: Honors or Dean's List

Mediumsql

Two tables track student distinctions: honors_students and deans_list, each just a student_id column. Write a query implementing the Union of both — every distinct student_id that appears on either list — ordered ascending.

sql
CREATE TABLE honors_students (student_id INTEGER NOT NULL); CREATE TABLE deans_list (student_id INTEGER NOT NULL);

Sample data (this is what your query runs against when you press Run):

sql
INSERT INTO honors_students (student_id) VALUES (1), (2), (5); INSERT INTO deans_list (student_id) VALUES (2), (3);

Input (stdin)

Output

Run your code to see output here...