SQL INSTR Function Real Usage

In terms of SQL, function means, definitely it returns result. Where as in the WHERE clause we use relational operators (>, <, =, LE, GE) etc. In the where clause, we may or may not get the result. 

If we want to find a certain character position in a String, we use INSTR function. Look at the syntax.

Syntax for INSTR()

INSTR(Colname, character to which position we need,start position,which char you need)

For example:

 Table Emp-name
 ------
 Rani Raghav
 -------- 

"Rani Raghav" - I want to find position for first space.

Select INSTR(name, ' ', 1, 1) from emp;

The result will be - 5.

Related

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.