60. All People Across Two Tables (UNION dedupe)
EasySet OperationsUNIONdeduplicationORDER BY
UNION stacks two result sets and removes duplicate rows, comparing the whole row across both sources. Use it when the same person/value can legitimately appear in both inputs and you want each only once.
Task: combine the employees and contractors name lists into one distinct list of people.
Return a single column name. Order by name ascending.
Tables
Loading schema…
Expected outputrows must come back in this order
Computing expected output…
This is the result for the example data above. On Submit your query is graded against this example plus 4 hidden edge cases — 5test cases in all. A sloppy query that only fits the example won't pass.
SQL· SQLite · runs in your browser
⌘/Ctrl+↵ run · ⇧⌘/Ctrl+↵ submit
Run a query to see its output here.