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 ...
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.
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 🙂
Thanks for the great content!. Please add the create/insert statements so that it is easy to do hands on
We use the row_number and also dense_rank approach in our spark code 😊
Cool
For the pair of columns to work, we can concat both and use the result.
Thanks. This is a cool trick.
In cases of pure duplicate we can use just group by over all the columns in the table .
Thanks... Great explanation... Subscribed to your channel..
Thank you 😊
Oh man ! Superb !
🙏
I have a scenario problem statement to share, How to share and need your support on that problem?
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
Very useful video
Sir , What if we have same and different created time?
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
Thanks bro
🥰🥰🥰
Welcome 🤗
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.
Sure
can we have the dataset to apply with you
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!
Check LinkedIn chat.
@@ankitbansal6 I will.Thank you!
@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