GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL

 Print  |  
Question:  Data Conversion

Answer: Have 2 table Emp1 (Column Name: Ename), 2nd table Emp2 (Column Name: First and Column Name: Last

Table Name :Emp1
EName
Hunt, Michael
Graham, Smith
Nelson, Ryan


Table Name: Emp2
First Last
Michael Hunt
Smith Graham
Ryan Nelson

Need to write a SQL query to convert the data from Emp1 to Emp2 in this way.
Can any body help me.

Thanks



June 06, 2008 22:31:29 #2
 astaputra   Member Since: June 2008    Total Comments: 2 

RE: Data Conversion
 

select SUBSTR('Hunt, Michael',1,INSTR('Hunt, Michael',',')-1) LAST_NAME,SUBSTR('Hunt, Michael',INSTR('Hunt, Michael',',')+1) FIRST_NAME from dual

Here is the example how to use and accordingly change the query and insert into another table.

Thks...

     

 

Back To Question