Hi Friends

I have a sql question, We have the source data as below.

101 address1, address2, address3

and the output shoulb like below

101 address1
101 address2
101 address3

Required a SQL query for this output.

Please let me know if you have any sql query for this.

Thanks in advance.

Hari M

Answers were Sorted based on User's Feedback



Hi Friends I have a sql question, We have the source data as below. 101 address1, address2,..

Answer / vennela12

Hi Hari.....try this

select 101,address1 from tablet1
union all
select 101,address2 from tablet1
union all
select 101,address from tablet1

By
Vennela

Is This Answer Correct ?    5 Yes 0 No

Hi Friends I have a sql question, We have the source data as below. 101 address1, address2,..

Answer / ronak

You have to use LPAD function,

Select lpad(address,20,'101')
from tableName;


NOTE: address is column name of address info, 20 is total
characters you want to display including 101 (since in this
case we don't know the characters of address),

Thank you
Ronak

Is This Answer Correct ?    3 Yes 0 No

Hi Friends I have a sql question, We have the source data as below. 101 address1, address2,..

Answer / ksks

Make use of UNPIVOT to split one record into many rows:
select id,address from T1 unpivot (address for address_type in (address1,address2,address3))

Is This Answer Correct ?    1 Yes 0 No

Hi Friends I have a sql question, We have the source data as below. 101 address1, address2,..

Answer / hari m

Hi Vennala

The posted query will work fine. But what if incase 'N'
no.of columns, like address1, address2..., address n.

The query will become lenghty with N no.of Unions.

Is there any script or procedure as alternative??

Please help me out in this regard.

Thanks,
Hari

Is This Answer Correct ?    0 Yes 0 No

Hi Friends I have a sql question, We have the source data as below. 101 address1, address2,..

Answer / tdguy

Hi Hari,
IF the source data is present in a file, then it can
be handled in the supporting OS say unix or mainframe,
whichever is being used. But the input data is present in a
single column, then i think UDF has to be used.

Is This Answer Correct ?    0 Yes 0 No

Hi Friends I have a sql question, We have the source data as below. 101 address1, address2,..

Answer / xxx

select 101 as 101,address1 from table1

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Teradata Interview Questions

how to load or extract the error table data ?

3 Answers  


What are some commonly used bteq scripts?

0 Answers  


What is Difference b/w PI & PPI?how to implement PPI?

3 Answers   Wipro,


hi frnds i want to learn teradata utilities and teradata dba real time. i have 1+ years of experience in teradata. so i want to go deeply in Tearada. plz let me know at my email id who r best to learn from. im lookng for a realtime guy in HYD or Banglr. Thanks in advance. Rajesh my email-id: rajeshmss87@gmail.com

0 Answers   IBM,


hi guys...i have good experiance in oracle ...now i want to learn teradata? how much of percentage my knowledge is used to understand the teradata? i mean.. if teradata also having sql queries or not?

1 Answers  






What is basic teradata query language?

0 Answers  


Explain and compare pros and cons of snow flake schemas?

0 Answers  


What is the purpose of upsert command?

0 Answers  


Explain some differences between mpp and smp?

0 Answers  


What is Join Index in TD and How it works?

6 Answers   BT, CSC, TCS,


During the Display time, how is the sequence generated by Teradata?

0 Answers  


IBM QUESTION As all we know PE takes the SQL Request and it will give responce for that query. what is the internal process happening.how it is taking that sql from the system????? thanks in Advance

2 Answers   Cap Gemini, IBM, Infosys,


Categories