Invalid Tweets
Preview mode. Log in to edit, run, submit, and save progress.
Medium
Description
You have a Tweets table. A tweet is considered invalid if its content length is strictly greater than 15 characters. Write a SQL query to find the IDs of all invalid tweets. Return the result in any order.
Database Schema
Tweets
| Column Name | Type | Description |
|---|---|---|
| tweet_id | INT | Primary key |
| content | VARCHAR | Text content of the tweet |
Example
Tweets
| tweet_id | content |
|---|---|
| 1 | Vote for Biden |
| 2 | Let us make America great again! |
Output
| tweet_id |
|---|
| 2 |
Explanation:
Tweet 1 has length 14 (valid). Tweet 2 has length 32 (invalid, > 15).
Approach hint
Start with a simple approach, explain the trade-off, then move toward a cleaner or more scalable solution.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.
SQL Editor
Loading...
Tweets
| tweet_id | content |
|---|---|
| 1 | Vote for Biden |
| 2 | Let us make America great again! |
Output
| tweet_id |
|---|
| 2 |