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
How is MLOAD Teradata Server restarted after execution?
In a table can we use primary key in one column and in another column both unique and not null constrains.if yes how?
What is a dimension table?
What are normalization, first normal form, second normal form and third normal form?
What are the different design perspectives used in teradata?
Highlight all the modes that are present under Confidence Level.
What type of indexing mechanism do we need to use for a typical data warehouse?
What is the use of fallback?
What are the steps involved after the disk manager passes the request?
What can be achieved by using the teradata rdbms?
What is the purpose of upsert command?
What is primary index and secondary index?
What are the design features involved in teradata?
Explain the term 'database' related to relational database management system?
Did you write stored procedures in teradata?