SQL Like Keyword, SQL Tutorial, Global Guide Line Technology.
Bookmark Bookmark: SQL Like Keyword, SQL Tutorial Forum | Blog |

      Home                    

Basic SQL Guide.           
SQL Introduction.               
 What is Table?                  
 SQL Create Table.            
 SQL Insert Statement.      
 SQL Select Keyword.        
 SQL Order by clause.        
 SQL Count Statement.      
 SQL Group By Clause.      
 SQL Having Clause.          
 SQL Alias Tables.             
 SQL Join Tables.              
 SQL Outer Join.               
 SQL Update Statement.   
 SQL Delete Statement.    
 SQL Distinct Keyword.      
 SQL Where Keyword.       
 SQL And Or Keyword.      
 SQL In Keyword.              
 SQL Between Keyword.   
 SQL Like Keyword.
 SQL Functions.                
 SQL Concatenate.           
 SQL Substrings.               
 SQL Trim Function.         
 SQL Constraints.              
 SQL Primary Key.            
 SQL Foreign Key.            
 SQL Create Views.           
 SQL Create Index.           
 SQL Alter Table.             
 SQL Drop Table.             
 SQL Truncate Table.      
 SQL Summary.                

SQL Tutorial >> SQL Like Keyword.


     Back             Next     



Now in SQL Tutorial we will discus Like Keyword, SQL LIKE keyword is another keyword that is used in the SQL WHERE clause. Basically, SQL LIKE keyword allows us to do a search based on a pattern rather than specifying exactly what is desired (as in SQL IN Keyword) or spell out a range (as in SQL BETWEEN Keyword). The syntax for SQL Like Keyword is as follows:

Syntax for SQL Like Keyword

SELECT "column_name"
FROM "table_name"
WHERE "column_name" LIKE {PATTERN}

{PATTERN} often consists of wildcards. Here are some examples of SQL Like Keyword.

'A_Z': All string that starts with 'A', another character, and end with 'Z'. For example, 'ABZ' and 'A2Z' would both satisfy the condition, while 'AKKZ' would not because there are two characters between A and Z as an alternative of one.

'ABC%': All strings that start with 'ABC'. For example, 'ABCD' and 'ABCABC' would both satisfy the condition

'%XYZ': All strings that end with 'XYZ'. e.g.  'WXYZ' and 'ZZXYZ' would both satisfy the condition.

'%TE%': All string that contain the pattern 'TE' anywhere. like, 'Kate' and 'Cute' would both satisfy the condition.

Let's say we have the following table:

Table: Employees

 

FirstName LastName Email DOB Phone
Austin Hennery austin.it@gamail.com 24/11/1978 446 102-2222
Creston Narvon narvon_crest@hotmail.com 22/04/1976 443 325-4545
Kate Bladen kbladen@usa.net 01/05/1980 326 503-3232
Angela Julie julieee@yahoo.co.uk 11/12/1977 326 323-8888
Bobbi Ferguson bobi123@kiwibox.com 10/02/1970 506 252-9875
Cute Alfa cafa@gmail.com 19/05/1972 506 272-4566

Example of SQL Like Keyword

SELECT *
FROM Employees
WHERE FirstName LIKE '%te%'

Results for SQL Like Keyword Example

FirstName LastName Email DOB Phone
Kate Bladen kbladen@usa.net 01/05/1980 326 503-3232
Cute Alfa cafa@gmail.com 19/05/1972 506 272-4566

     Back             Next     
 

[ About ] [ Contact ] [ Home ]
[ Links ] [ Site Map ] [ Services ] [ Privacy ]

Copyright 2005 -  2018 www.globalguideline.com All rights reserved. (Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher) 234 visitors are online now