SQL Interview question : Deleting duplicate records

preview_player
Показать описание
SQL most common Interview question : How to delete duplicate records in SQL?

Here is the explantion of the above query :

ROW_NUMBER(): This is a window function in SQL that assigns a unique sequential number to each row within a result set. The numbering starts from 1 and increases incrementally.

OVER: This keyword indicates that we are applying a window function.

(partition by CustID Order by CustID): This part of the query is defining the window within which the ROW_NUMBER() function operates.

partition by CustID: This means that the rows will be partitioned (grouped) by the CustID column. This implies that the ROW_NUMBER() will restart counting from 1 for each unique CustID.
Order by CustID: Within each partition, the rows will be ordered by the CustID. This determines the sequence in which the row numbers will be assigned.

Happy Learning !!

#interviewquestions #EY #sqlinterviewquestionsandanswers
Рекомендации по теме
Комментарии
Автор

How to delete from customer... Cte not

PradipChavan-ozdc
visit shbcf.ru