lesson sixth filtering with wildcard characters6.1 Like operatorThe wildcard itself is actually a character that has special meanings in the WHERE clause of SQL, and SQL supports several wildcard characters. To use wildcard characters in a search
First, like operatorAll of the operators described earlier are filtered for known values . Whether you match a value or multiple values, the test is greater than or less than the known value, or the value of a range is checked, the common
Wildcard characters
Wildcards in SQL are used in place of one or more characters.
SQL wildcard characters are used with the LIKE operator.
Common wildcard characters in SQL Server
%
Matches an arbitrary length character (length can be 0)
If
Sqllike wildcard [] % instance tutorial
SQL like wildcard [] % instance tutorial
SQL like wildcard [] % instance tutorial
Note: Both mysql, SQL server, and dbms do not support text and ntext only support like wildcards.
Char, varchar, nvarchar,
Tag: A uses SQL Server SQL Server_,%, [], ^1, ^ only MSSQL server support, other DBMS with not like.2, wildcard% multi-character matching wildcard character, it matches any number of times (0 or more) occurrences of any character3, Wildcard _ single-
Note: Mysql,sql Server,dbms and so on like wildcard characters do not support Text,ntext support only
Char,varchar,nvarchar, wait.
$s = "SELECT * from Test where dmulplace like '% $city% '"ID UID parttime City211 7117 Full-time Changsha, Yiyang5510
1, Understand sql1.1 Database Foundation 1.1.1 Database: A container that holds organized data (usually a file or a set of files) (also understood as a collection that is stored in an organized manner)Note: Database software is called DBMS (Database
1.LIKE operator1.1 Percent percent (%) wildcard characterSELECT prod_id, Prod_name from Products WHERE prod_name like ' Fish%
'This example uses the search mode ' fish% '. When the sentence is executed, any word that begins with fish will
SQL is required and SQL is required1. LIKE Operator
1.1Percent sign (%) Wildcard
SELECTProd_id, prod_nameFROMProductsWHEREProd_nameLIKE'Fish%'
The search mode 'fish % 'is used in this example '. When this clause is executed, any words starting
"MySQL must know" notes-partComments:Start to organize notes, record their own reading process of doubt and focus, later found that the record does not have much meaning, it is better to go directly to the original book, so give up.So the note is
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.