Skip to main content
Practice

7

sql

-- Combine both user tables, removing duplicates
SELECT user_id, name FROM users_2023
UNION
SELECT user_id, name FROM users_2024;

-- Combine both user tables, keeping all rows (including duplicates)
SELECT user_id, name FROM users_2023
UNION ALL
SELECT user_id, name FROM users_2024;

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.