Skip to content

Commit 8c0ae0c

Browse files
authored
EASY
1 parent 5c829e0 commit 8c0ae0c

File tree

1 file changed

+50
-2
lines changed

1 file changed

+50
-2
lines changed

1683. Invalid Tweets.sql

+50-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,50 @@
1-
select tweet_id from Tweets
2-
where char_length(content) > 15
1+
-- Problem:
2+
3+
/*
4+
Table: Tweets
5+
6+
+----------------+---------+
7+
| Column Name | Type |
8+
+----------------+---------+
9+
| tweet_id | int |
10+
| content | varchar |
11+
+----------------+---------+
12+
tweet_id is the primary key (column with unique values) for this table.
13+
This table contains all the tweets in a social media app.
14+
15+
16+
Write a solution to find the IDs of the invalid tweets. The tweet is invalid if the number of characters used in the content of the tweet is strictly greater than 15.
17+
18+
Return the result table in any order.
19+
20+
The result format is in the following example.
21+
22+
23+
24+
Example 1:
25+
26+
Input:
27+
Tweets table:
28+
+----------+-----------------------------------+
29+
| tweet_id | content |
30+
+----------+-----------------------------------+
31+
| 1 | Let us Code |
32+
| 2 | More than fifteen chars are here! |
33+
+----------+-----------------------------------+
34+
Output:
35+
+----------+
36+
| tweet_id |
37+
+----------+
38+
| 2 |
39+
+----------+
40+
Explanation:
41+
Tweet 1 has length = 11. It is a valid tweet.
42+
Tweet 2 has length = 33. It is an invalid tweet.
43+
*/
44+
45+
-------------------------------------------------------------------------------
46+
47+
-- Solution:
48+
49+
SELECT tweet_id FROM Tweets
50+
WHERE char_length(content) > 15

0 commit comments

Comments
 (0)