<aside> 💡

Project Overview:

This project identifies invalid tweets from a social media database. A tweet is considered invalid if the length of its content exceeds 15 characters. The solution demonstrates the use of SQL functions to process text data and apply conditional filtering.

</aside>


Problem Description:

Table: Tweets

A tweet is invalid if the length of its content is strictly greater than 15.

The task is to return the tweet_id of all invalid tweets.


Solution:

The query uses the LENGTH() function to calculate the number of characters in the content column and filters rows where the length exceeds 15.

SELECT
    tweet_id
FROM
    Tweets
WHERE
    LENGTH(content) > 15;


Explanation:

  1. Text Length Calculation:
  2. Filtering Invalid Tweets:
  3. Selecting Tweet IDs:

Example Input and Output:

Input: