How to Delete Duplicates in Production Environment | SQL Delete Duplicate Rows

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.ย. 2024
  • In this video we will discuss multiple scenarios of duplicate data. We will see how we can delete duplicates with backup.
    Playlist for complex SQL questions:
    • Complex SQL Questions ...

ความคิดเห็น • 27

  • @sowmiyav4003
    @sowmiyav4003 2 ปีที่แล้ว +3

    Hi Ankit,
    Your videos are really helpful. I am regularly watching your videos and learning SQL.
    A small request from my side. Could you please mention CREATE TABLE and INSERT VALUES statements in description so that its easy for the viewers to practice.

    • @ankitbansal6
      @ankitbansal6  2 ปีที่แล้ว +1

      Hi Sowmiya. I mostly put the create and insert for all the scenario based problems. This was more concept based video. Going forward will put for all the videos.
      Thanks for watching the videos. It means a lot to me 🙂

  • @sonunitjsr223
    @sonunitjsr223 ปีที่แล้ว

    Thanks for the great content!. Please add the create/insert statements so that it is easy to do hands on

  • @aneksingh4496
    @aneksingh4496 2 ปีที่แล้ว +1

    We use the row_number and also dense_rank approach in our spark code 😊

  • @PriyaYadav-jh5wj
    @PriyaYadav-jh5wj 2 ปีที่แล้ว +2

    For the pair of columns to work, we can concat both and use the result.

    • @ankitbansal6
      @ankitbansal6  2 ปีที่แล้ว +1

      Thanks. This is a cool trick.

  • @subhojitchatterjee2761
    @subhojitchatterjee2761 2 ปีที่แล้ว

    In cases of pure duplicate we can use just group by over all the columns in the table .

  • @Mysingh9767
    @Mysingh9767 2 ปีที่แล้ว

    Thanks... Great explanation... Subscribed to your channel..

  • @vijaypalmanit
    @vijaypalmanit 2 ปีที่แล้ว

    Oh man ! Superb !

  • @sagarthapliyal155
    @sagarthapliyal155 ปีที่แล้ว

    I have a scenario problem statement to share, How to share and need your support on that problem?

  • @ayankumarbajpai6533
    @ayankumarbajpai6533 ปีที่แล้ว

    I'm new to SQL, so is there any way we can do it without backing up or the tables which don't have timestamps? It is really confusing as a beginner

  • @sreemalapal
    @sreemalapal 6 หลายเดือนก่อน

    Very useful video

  • @sagarthapliyal155
    @sagarthapliyal155 ปีที่แล้ว

    Sir , What if we have same and different created time?

  • @rajkumarrajan8059
    @rajkumarrajan8059 9 หลายเดือนก่อน

    Msg 4104, Level 16, State 1, Line 77
    The multi-part identifier "T.ORDER_ID" could not be bound.
    Msg 4104, Level 16, State 1, Line 77
    The multi-part identifier "T.CREATE_TIME" could not be bound.
    DELETE T
    FROM TRANSACTIONS
    INNER JOIN
    (
    SELECT
    ORDER_ID
    ,MIN(CREATE_TIME) AS [CREATE_TIME]
    FROM
    TRANSACTIONS
    GROUP BY
    ORDER_ID
    HAVING
    COUNT(1) >1
    ) A
    ON T.ORDER_ID=A.ORDER_ID AND T.CREATE_TIME=A.CREATE_TIME
    For the Query i am getting the above error

  • @sudarshanthota4444
    @sudarshanthota4444 2 ปีที่แล้ว

    Thanks bro
    🥰🥰🥰

  • @abhikworld
    @abhikworld 2 ปีที่แล้ว +1

    Hey Ankit , Can you make videos on Indexing, normalization , views and their use cases. You can also create your telegram channel so that more people will join and can discuss sql queries.

  • @sherifelgazar4089
    @sherifelgazar4089 ปีที่แล้ว

    can we have the dataset to apply with you

  • @florincopaci6821
    @florincopaci6821 2 ปีที่แล้ว +1

    Hello Sir ! Thank you once again for other useful video!
    Many Thanks!
    I have a big request(maybe someone reed my comment and help me) please-i don t have a LeetCode subscription and i have left to solve only 2 question regarding SQL-2153-The number of passengers in each bus || and the last question 2175-The Change in Global Rankings
    Please can you help me only with the data from this 2 question and the requests-i don t need the solution.
    I can not find on internet the data from this 2 question.
    I will let here my solution-maybe is useful for someone at the question2142-The number of passengers in each bus | -
    with bus as (
    select bus_id, arrival_time,
    row_number()over(order by arrival_time) as tip
    from buses
    )
    select b.bus_id, count(p.pasager_id) as how_many
    from bus b left join passengers p on p.arrival_id between b.tip and b.arrival_time
    group by b.bus_id
    order by 1
    All the best!

  • @smitnema9760
    @smitnema9760 ปีที่แล้ว

    @ankit bansal
    sir what if my data is something like this and i cannot use cte because i am not using sql servere
    id name salary dept_id
    -- ---- ------ -------
    E1 XYZ 80000 1
    E1 XYZ 80000 1
    E1 XYZ 80000 1
    E2 PQR 82000 5