Write a single SQL to delete duplicate records from the a
single table based on a column value. I need only Unique
records at the end of the Query.

Answer Posted / bharath

guys rowid concept is discontinued in teradata as far as my
knowledge goes, we can always use below sql ...

INSERT INTO nodupes_table ( all_columns )
SELECT all_columns
FROM dupes_table
QUALIFY ...

where the QUALIFY ... can be (depending on your version):
/* V2R5 syntax */
QUALIFY ROW_NUMBER() OVER (PARTITION BY all_columns
ORDER BY all_columns) = 1

/* or V2R4 and higher equivalent functionality */
GROUP BY all_columns
QUALIFY CSUM(1, all_columns ) = 1

/* or, alternative OLAP SUM V2R4 and higher syntax */
QUALIFY SUM(1) OVER (PARTITION BY all_columns ORDER BY
all_columns ROWS
UNBOUNDED PRECEDING ) = 1


I do think an insert-select into a set table would be a
cleaner process (don't know about runtime, though):
INSERT INTO nodupes_set_table ( all_columns )
SELECT all_columns
FROM dupes_table;


refer to teradata forum for more info

Is This Answer Correct ?    17 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the joins in teradata and how many types of joins are there in teradata?

585


Give the sizes of SMALLINT, BYTEINT and INTEGER.

672


how do we write scripts in unix how to execute scripts in real time anybody please needfull or give me number i will cal u

1284


What is node? How many nodes and amps used in your previous project?

685


Explain some differences between mpp and smp?

602






What are normalization, first normal form, second normal form and third normal form?

642


Briefly explain each of the following terms related to relational database management system (rdbms) – database, tables, columns, row, primary key and foreign key.

598


Can any one explain me the difference between BTEQ and MLOAD,TUMP. All canbe used for same purpose but still differnt methods. why ?

3012


Highlight the advantages of PPI(Partition Primary Index).

567


What are the various indexes in teradata? How to use them? Why are they preferred?

603


Explain and compare pros and cons of start schemas?

554


What tools would you use for that?

580


Explain the parallel data extension in teradata?

665


What is primary index and secondary index?

582


List the logical and conditional operators that are used with teradata along with their meanings?

562