We often search to find a certain data easily in our database. Such as searching for a friends name in facebook. And perhaps, searching for a book in an Online Public Access Catalog (OPAC).
SQL Wildcard is commonly used to find for a certain pattern based on a string. Let's say, you want to display all city that contains "ay". To be able to do this, we need to use sql wildcards which is represented by a percent sign (%). So you need to put a percent sign (%) on both sides. It means you can insert/put any values before and after the letters "ay".
Table
CUSTOMER |
SQL Query
select customer_address from customer where customer_address LIKE "%ay%"
Output
The output didn't include Bago City since Bago City does not contain "ay".
Another sql wildcard is the underscore (_). It represents a single character only. Let's say a_c will match values abc, adc but not abb.
0 comments:
Post a Comment