Switch to full style
Include SQL commands
Post a reply

SQL LIKE query Command

Mon Jul 16, 2012 1:20 am

You can LIKE keyword for matching and searching for records, for example if we are looking for a records with a column contains a specific string value :

Code:

SELECT 
FROM  Department WHERE name LIKE '%IT%'
 



we can also get Departments records start with IT as follows :
Code:

SELECT 
FROM  Department WHERE name LIKE 'IT%'
 


and end with IT :
Code:

SELECT 
FROM  Department WHERE name LIKE '%IT'
 



Underscore can be use as wildcard for one character space :
Code:

SELECT 
FROM Department  WHERE DepId LIKE '__33'
 


The previous SQL means to return all records with ids start with any two numbers but end with 33.



Post a reply
  Related Posts  to : SQL LIKE query Command
 EJB-QL IN where query     -  
 BETWEEN SQL COMMAND     -  
 SQL AND OR in WHERE query Commands     -  
 Query about jsp and printer     -  
 insert query example     -  
 SQL GROUP BY Command     -  
 SQL ALTER Command     -  
 SQL DISTINCT Command     -  
 update query example     -  
 Average SQL command     -