Switch to full style
Include SQL commands
Post a reply

SQL LOCATE command

Mon Jul 16, 2012 12:43 pm

You can use LOCATE command to find a position of string inside another one for instance :

Code:

select locate
('ah',aewgahrta)
 


This query will return 5. You can also use LOCATE keyword in the where clause :


Code:

SELECT 
* FROM 'Department' WHERE locate( 'IT', name )
 


The previous search for the existence of sub string "IT" in the column name. You also print the location of sub-string for each record.


Code:

SELECT locate
('IT',name) as position,name FROM 'Department'
 




Post a reply
  Related Posts  to : SQL LOCATE command
 BETWEEN SQL COMMAND     -  
 JVM does not recognize MQ command.     -  
 SQL LIKE query Command     -  
 SQL ALTER Command     -  
 Calling the man Command     -  
 SQL GROUP BY Command     -  
 SQL DISTINCT Command     -  
 Average SQL command     -  
 PHP echo command     -  
 SQL COUNT Command     -