ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Data Warehouse  >>  Teradata
 
 


 

 
 Teradata interview questions  Teradata Interview Questions
 Business Objects interview questions  Business Objects Interview Questions
 Cognos interview questions  Cognos Interview Questions
 Informatica interview questions  Informatica Interview Questions
 Crystal Enterprise Suite interview questions  Crystal Enterprise Suite Interview Questions
 Actuate interview questions  Actuate Interview Questions
 Ab Initio interview questions  Ab Initio Interview Questions
 Data Stage interview questions  Data Stage Interview Questions
 SAS interview questions  SAS Interview Questions
 Micro Strategy interview questions  Micro Strategy Interview Questions
 ETL interview questions  ETL Interview Questions
 Data Warehouse General interview questions  Data Warehouse General Interview Questions
Question
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.
 Question Submitted By :: Hardeep
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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
# 1
One need have atleast a unique column such as timestamp col 
(and assumption is to keep lowest tmpstmp) OR some  key col 
say IPID (again keep lowest value)..

One determined - Have a nested Select on all rows (except 
that key col) with group by rest of the columns + having 
count(*) > 0 + aggreate MIN(key_col).

    Now said that, have another outer SEL on all columsn & 
do a inner join with above nested Sel .. WHERE outer 
key_col <> MIN value of nested SEL..

See if it works..
 
Is This Answer Correct ?    2 Yes 6 No
Manny
 
  Re: 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
# 2
Nested query method might be required in other databases 
how ever in TD we don’t need to follow such a difficult way 
to just find out the unique rows. 

In TD we have functions like Rank () and Rownum() in the 
combination of Qualify, helps you to select out the rows  
which you wants to delete.
 
you can add a condition like ‘Where Rank() > 1’
 
Is This Answer Correct ?    0 Yes 4 No
Milind
 
 
 
  Re: 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
# 3
Query to find duplicates in a table:(Custname, Prod, 
Order_amt)

select custname,count(*) from sales1 a where a.rowid > ANY 
(select b.rowid from sales1 b where a.custname=b.custname 
and a.prod=b.prod and a.order_amt=b.order_amt) group by 
custname;

Query to delete duplicates:

delete from sales1 a where a.rowid > ANY (select b.rowid 
from sales1 b where a.custname=b.custname and a.prod=b.prod 
and a.order_amt=b.order_amt);
 
Is This Answer Correct ?    1 Yes 1 No
Nunna
 
  Re: 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
# 4
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 ?    7 Yes 0 No
Bharath
 
  Re: 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
# 5
The following example shows how to create table and insert 
data without duplicate rows from existing table:

CREATE TABLE NODUPS AS
(
	SELECT * FROM Departments
	UNION
	SELECT * FROM Departments
)
WITH DATA;
 
Is This Answer Correct ?    1 Yes 1 No
Petko Petkov
 

 
 
 
Other Teradata Interview Questions
 
  Question Asked @ Answers
 
Explain about Skew Factor?  4
What is use of compress in terdata?Explain?  3
what is the difference between start schma and Fsldm? Intel3
What is the diffrence between Multiload & Fastload interms of Performance? Intel3
I have all the TERADATA Certification Dumps for the below: NR0-011, NR0-012, NR0-013, NR0-014 NR0-015 NR0-016, NR0-017 If anyone need it, pls drop me a mail with Code in the mail to: terashish@gmail.com IBM4
How to find No. of Records present in Each AMP or a Node for a given Table through SQL? IBM1
Please tell me a query to find the Primary key,Foreign key,primary Index,PPI for the Database?  1
What is Join Index in TD and How it works? TCS1
How can we build data marts from FSLDM. is there any standard approach for this?Is FSLDM supports place ?  2
Why Fload doesn’t support multiset table?  5
IN A TABLE CAN WE USE PRIMARY KEY IN ONE COLUMN AND IN ANOTHER COLUMN BOTH UNIQUE AND NOT NULL CONSTRAINS.IF YES HOW?PLZ GIVE ME A EXAMPLE.  2
Can any one plz provide the teradata interview questions?  2
Does any body has TERADATA Certification Dumps, if any body is having please let me know to summee4you@gmail.o, it is very Very URGENT to me TCS2
What is the process to restart the multiload if it fails?  3
How does indexing improve query performance? Satyam3
Why AMP & PE are called Vprocs?  2
can we have an unconnected lkp to lookup a DB2 record against a Teradata record?  2
How to Skip or Get first and Last Record from Flat File through MultiLoad and TPUMP Utility? IBM2
I WANT TO LEARN TERA-DATA ,SO CAN ANY BODY PLZ REFER WHAT ARE THE TOPICS I HAVE TO GO THROUGH, TO GET ASAP JOB ,SO PLZ REFER ME WHERE I CAN GET NICE COACHING ON TERADATA.  1
IS IT POSSIBLE THAT THERE R TWO PRIMARY KEY WILL BE IN A SAME TABLE?PLZ HELP ME BY GIVING THE ANSWER.THANK U.  4
 
For more Teradata Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com