Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7720109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:34:53+00:00 2026-06-01T03:34:53+00:00

Consider the following tweets table tweet_id user_id text —————————————– 1 1 look at my

  • 0

Consider the following “tweets” table

tweet_id  user_id  text
-----------------------------------------
1         1        look at my tweet
2         1        look at my tweet
3         1        a very different tweet
4         1        look at my tweet
5         1        look at my tweets
6         2        a cool tweet
7         2        this is my tweet
8         1        hello
9         1        hello

For each user, I want to count the number of duplicate tweets. In the example above, user_id 1 has a total of 5 tweets, of which 2 are unique (tweet_id 3 and 5) and 3 are duplicate (1, 2 and 4). So the outcome of the query for user 1 should be “3”.

[EDIT]
Look at user_id 1. The tweet “look at my tweet” appears 3 times, the tweet “hello” 2 times. The total number of duplicate tweets is then 3 + 2 = 5.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:34:54+00:00Added an answer on June 1, 2026 at 3:34 am

    For the first part, you can use the following query

    select user_id, sum(count)
    from
    (
    select user_id, text, count(tweet_id) count
    from tweets 
    group by 
    user_id, text
    having count(tweet_id) > 1
    ) t
    group by user_id
    

    The inner query finds all users and tweets that have occured more than once. The outer query adds up the duplicate values for each user

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please consider the following tweets table: tweet_id user_id text ---------------------------- 1 1 lorem ipsum
Consider the following tables: users and tweets user_id name tweet_id user_id tweet spam -----------------
Consider the following table tweets tweet_id call_id id_str timestamp text -------------------------------------------------- 1 11 12345
Consider the following table (tweets): +---------+------------+----------+ | user_id | _date | tweet_id | +---------+------------+----------+
Consider the following tables users tweets --------------------------------- --------------------------- user_id num_retweets sum_retweets tweet_id user_id retweeted
Consider the following table tweets --------------------------------- tweet_id nyse_date class type --------------------------------- 1 2011-03-12 2
Consider the following table: tweets ----------------------- id tweet class ----------------------- 1 Foo bar baz!
Consider the following three MySQL tables: tweets urls tweets_urls --------------------------- --------------------- ---------------- tweet_id text
Consider the following table of tweets id tweet ------------------------------------------------------ 1 alcoa inc stock analysis
Consider the following tweets: RT @username This is my tweet Check this! RT @username

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.