Like shown below i have 3 columns(Name,No,Address). The
values in name column i want to modity.
Requirement : Keep only once space between two words
(Fname,Lname) in the Name column.
For this what is the query? Please answer me. Advance
Thanks.


Name No Address Reference

manoj kumar
kumar raja
vinzay kumar
rajendra prasad
gowri nath -- -- --

Answers were Sorted based on User's Feedback



Like shown below i have 3 columns(Name,No,Address). The values in name column i want to modity. R..

Answer / kavitha n

SELECT NAME,
( SUBSTR (NAME, 1, (INSTR (NAME, ' ', 1)))
|| ''
|| SUBSTR (NAME, INSTR (NAME, ' ', -1), LENGTH (NAME))
) output
FROM test;

Is This Answer Correct ?    5 Yes 2 No

Like shown below i have 3 columns(Name,No,Address). The values in name column i want to modity. R..

Answer / lince

select substring(NAME,1,charindex(' ',NAME))+' '+
replace(substring(NAME,charindex(' ',NAME),len(NAME)),' ','')
as NAME from test

Is This Answer Correct ?    1 Yes 0 No

Like shown below i have 3 columns(Name,No,Address). The values in name column i want to modity. R..

Answer / kalyan

update test set NAME=regexp_replace(NAME,'( ){2,}', ' ')

Is This Answer Correct ?    1 Yes 0 No

Like shown below i have 3 columns(Name,No,Address). The values in name column i want to modity. R..

Answer / manojkumar

Thanks to Kavitha and Lince.
Both answers are correct in oracle and in Sql Server.
Excellent
Thanks a lot

Is This Answer Correct ?    0 Yes 0 No

Like shown below i have 3 columns(Name,No,Address). The values in name column i want to modity. R..

Answer / swastik

select substr(name,1,instr(name,' ',1)-1)||substr(name,instr(name,' ',-1),length(name)) from spacename

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

Is and as keyword in pl sql?

0 Answers  


what is the difference between implicit and explicit trigger

2 Answers   Tech Mahindra,


How many triggers can be implemented for a table?

3 Answers   HSBC,


What is bulk compiling in pl/sql.?

0 Answers   MCN Solutions,


what is self join and what is the requirement of self join? : Sql dba

0 Answers  






How long will it take to learn pl sql?

0 Answers  


Is sql workbench free?

0 Answers  


Can you rollback after commit?

0 Answers  


explain advantages of myisam over innodb? : Sql dba

0 Answers  


Use The Implicit cursor to Query The Department table information Where Deptno is 30.check,if no record was found then print "Record Was Not Found".Else Print Deptname And Ename.Dept table Have Dname Varchar2(20),Deptno Number,EnameVarchar2(20).Please Answer In 2 mins,with in Maximum 15 lines.

5 Answers   Wipro,


What is a constraint? Tell me about its various levels.

0 Answers  


1 SELECT a.field1, b.field2, c.field3, d.field4 2 FROM atable a, atable b, ctable c, dtable d 3 ? 4 ORDER BY 1 What is the minimum number of joins that must be specified on line 3 in the sample code above to properly link the tables? Notice that the table "atable" is aliased twice: once as "a" and once as "b." 1. One join 2. Two joins 3. Three joins 4. Four joins 5. Five joins

6 Answers   Sonata,


Categories