Your question is SQL: Unique Words Between Messages. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Discord wants to compare two messages from a channel and identify words that appear in only one of them. Write a PostgreSQL query that tokenizes the selected messages, removes words shared by both messages, and returns each remaining word once.
discord_messages, joining discord_channels to verify they belong to the requested Discord channel.| Column | Type | Description |
|---|---|---|
| channel_idPK | INTEGER | Discord channel identifier |
| channel_name | VARCHAR(100) | Human-readable Discord channel name |
| Column | Type | Description |
|---|---|---|
| message_idPK | INTEGER | Discord message identifier |
| channel_id | INTEGER | Channel containing the message |
| content | TEXT | Message text |