What is the SQL query to select, delete and get count of
duplicate rows in DB2?
Answers were Sorted based on User's Feedback
Answer / igor kramov
DELETE FROM (
SELECT ROWNUMBER() OVER (PARTITION BY c1, c2 ORDER BY c3
DESC) AS rnum FROM t1)
WHERE rnum > 1 ;
the same is for Select\Count
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / hkhatri27
SELECT Columns
FROM Table
GROUP BY Columns
HAVING COUNT(*) > 1;
~ Himanshu
| Is This Answer Correct ? | 2 Yes | 2 No |
what will be the output of the below given query, if no matching records are found : (a.) 0 (b.) null (c.) error select Avg(salary) from TableA where Deptno = 'insurance'
How to handle null values in db2
What are some characteristics of columns that benefit from indexes?
In a single table,How to retrieve a employee-id of an employee who works in more than one department?
What is a predicate?
If we keep the DCLGEN structure for a table in a copybook and include it in the COBOL program using the COPY statement, will there be any impact during compilation or at any stage of program execution?
How to execute stored procedure in db2 command editor?
Explain what are the various isolation levels possible?
On which levels locks can be applied?
Explain packages.
how do you resolve -805?
Explain the function done by data manager?