How To Delete Duplicate Rows In a Table | SQL | Interview Preparation

How To Delete Duplicate Rows In a Table | SQL | Interview Preparation

CodeEra

2 года назад

24,178 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@vishalsonawane.8905
@vishalsonawane.8905 - 09.09.2021 23:30

Hello Mam,
Please make more videos .. beacuse your videos is very helpful .

Ответить
@user-ej4yz3mb6u
@user-ej4yz3mb6u - 14.11.2023 09:44

I am getting below error
Error: near "E1": syntax error

Ответить
@KIRANYADAV-kx7wu
@KIRANYADAV-kx7wu - 18.09.2023 16:28

executed first query using group by and having clouse but deleted all the duplicate rows not single/distinct record remain in table

Ответить
@khabib29-06
@khabib29-06 - 29.07.2023 08:18

Not possible select*,count (*)

Ответить
@ravirajpradhan4720
@ravirajpradhan4720 - 17.07.2023 12:30

I seen your SQL video today, really great point wise concept wise explanation with design and attractive interface , But the one thing that u mention in this video-- "YOU CANT SPECIFY TARGET TABLE" error -- I mean to say little little loop holes also u have taken and whatever the concept u are delivering which is perfect -- really nice -- great teaching -- Keep it up -- really great

Ответить
@user-lh4di9zg3u
@user-lh4di9zg3u - 06.05.2023 13:16

HI, but here the ids 2 and 5 which occur multiple times(2 times) deleted, But actually we need to keep the 2 and 5 ids aswel , delete only the 2nd time occuring data , means i need all the IDs data ( 1 to 9 ids)

Ответить
@electricalsir
@electricalsir - 31.03.2023 16:07

Thank you ma'am it's very useful to us 💖🤠

Ответить
@MAMAKIJAANGUGU
@MAMAKIJAANGUGU - 02.03.2023 08:30

Only self join one worked for me. Somehow Im not able to select id or * from the table

Ответить
@allauddinmomin8814
@allauddinmomin8814 - 26.10.2022 08:02

Madam can you write a query that "how to delete duplicates by rank function" and i'm searching everywhere but i didn't get the answer😒

Ответить
@Sandeeptez
@Sandeeptez - 23.08.2022 07:33

Saloni star

Ответить
@saikiranarani1993
@saikiranarani1993 - 15.08.2022 22:32

please upload video to delete duplicates using CTE and Rank Functions pls excellent convey of knowledge being non IT i understood sooper

Ответить
@manishmishra6245
@manishmishra6245 - 23.07.2022 23:53

What if dept is also same

Ответить
@deepaklobaniya8701
@deepaklobaniya8701 - 20.07.2022 15:39

Mam this is my table.

+-------+---------+--------+
| empid | empname | eadd |
+-------+---------+--------+
| 1 | deepak | Indore |
| 1 | deepak | Indore |
| 1 | deepak | Indore |
| 1 | deepak | Indore |
| 1 | deepak | Indore |
| 1 | deepak | Indore |
| 1 | deepak | Indore |
| 2 | vikas | Bhopal


delete from details
where empid IN
(select empid from
(select *, count(*) as duplicate
from details
group by empid having duplicate>1)
as temp) ;

After executing above query wrong getting output.
Like this : i want two records but it deleting whole recors
those row have same value not remaining single row.

+-------+---------+--------+
| empid | empname | eadd |
+-------+---------+--------+
| 2 | vikas | Bhopal |
+-------+---------+--------+


please resolve it.

Ответить
@ShravanKumar-me6iy
@ShravanKumar-me6iy - 09.06.2022 21:11

Saloni ur super in teaching skills

Ответить
@sriramch3128
@sriramch3128 - 06.06.2022 19:20

First method getting error

Ответить
@sidharthmandal9957
@sidharthmandal9957 - 10.04.2022 23:35

What if the ID’s are also the same?
in that case your query fails i guess ??

Ответить
@ShivamSingh-hk5pn
@ShivamSingh-hk5pn - 24.01.2022 12:07

You are so pouring compassion on engineering boys... Really ur Heart is filled with humility and gratitude... Which is very rare in modern times... Good saloni ji
Keep it up

Ответить
@sambebhanuchandar562
@sambebhanuchandar562 - 21.01.2022 08:27

Nice explanation mam

Ответить
@BHARATHEEYUDU.
@BHARATHEEYUDU. - 04.01.2022 14:51

we can use distinct keyword

Ответить
@surajkumar-tt8yd
@surajkumar-tt8yd - 12.10.2021 07:20

Make complete sql in one video

Ответить
@nishkarshjain5684
@nishkarshjain5684 - 12.09.2021 20:00

Thanks a lot... ❤️

Ответить
@rishabhrishu1602
@rishabhrishu1602 - 07.09.2021 20:45

thanqq ma'am please make some video on interview question

Ответить
@sourabhgupta190
@sourabhgupta190 - 07.09.2021 18:33

Thankyou for making video on that topic 😊

Ответить
@anoopsharma5112
@anoopsharma5112 - 07.09.2021 16:03

Good work mate♥️

Ответить
@ayushmahajan1969
@ayushmahajan1969 - 07.09.2021 14:50

Very helpful 👌👌

Ответить