Leetcode SQL 50 -- 1683. Invalid Tweets
Question
Table name: Tweets
| Column Name | Type |
|---|---|
| tweet_id | int |
| content | varchar |
tweet_id is the primary key (column with unique values) for this table.
This table contains all the tweets in a social media app.
Write a solution to find the
IDsof the invalid tweets.
The tweet is invalid if the number of characters used in thecontentof the tweet is strictly greater than 15.
Return the result table in any order.
Explaination
To check the number of character, we can use the LENGTH(<string>) function.
If you use this function on numbers (e.g. int), it will turn it into string and return number of digits.
Solution
SELECT tweet_id FROM Tweets WHERE LENGTH(content)>15;
More SQL 50 questions: here
Leetcode SQL 50 -- 1683. Invalid Tweets