SQL, the wildcard characters of the LIKE operator (%, _ , [] and ^)
Hi Guys, Today a quick and easy post to answer a question that was asked to me some time ago. We will talk about the wildcard characters of the like operator . In its simplicity I think it is useful to who is entering the world of the SQL language. Enjoy the reading! Wildcard characters of the LIKE operator SQL ANSI LIKE operator has different wildcard characters which are: The percent sign % The underscore _ The square braket [^] and [] Their use is very simple! The percent sign (%) wildcard The percent sign (%) allows you to find if a substring is contained within a string. For example we can write the following query: SELECT * FROM ITEMS WHERE NAME LIKE '%AD%' This statements will return all the rows of items table where the field name contain the string "AD" in any position. For example: R AD IO BL AD E AD VERTISING The underscore ( _ ) wildcard Looking at the following statement the underscore wildcard allows you to find all the r...