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
IDs
of the invalid tweets.
The tweet is invalid if the number of characters used in thecontent
of 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
Please cite the source for reprints, feel free to verify the sources cited in the article, and point out any errors or lack of clarity of expression. You can comment in the comments section below or email to GreenMeeple@yahoo.com