Home > Database > SQL > body text

What does arbitrary character represent in sql?

下次还敢
Release: 2024-05-01 23:45:27
Original
647 people have browsed it

The wildcard character representing any character in SQL is the percent sign (%). It can be placed at the beginning, end, or middle of a pattern string to match characters at the beginning, end, or inclusion of the specified string.

What does arbitrary character represent in sql?

What is the wildcard representing any character in SQL

In SQL, the wildcard character representing any character is percent Number(%).

How to use the percent sign wildcard character

The percent sign wildcard character can be placed at the beginning, end, or middle of the pattern string.

  • Starting position: Matches all values ​​starting with the specified string. For example, �c matches any value that begins with "abc".
  • Ending position: Matches all values ​​ending with the specified string. For example, abc% matches any value that ends with "abc".
  • Middle position: Matches all values ​​that contain the specified string. For example, �c% matches all values ​​that contain the "abc" substring.

Example

  • SELECT * FROM table_name WHERE column_name LIKE '%john%' Matches all subtitles containing "john" The column_name column of the row of strings.
  • SELECT * FROM table_name WHERE column_name LIKE 'a%b%' Matches the column_name column of all rows that begin with "a" and end with "b".
  • SELECT * FROM table_name WHERE column_name LIKE '%' Matches the column_name column of all rows (because any string contains the empty string).

Note:

The percent wildcard is not case-sensitive and can be used with other wildcards, such as the underscore (_), which matches a single character .

The above is the detailed content of What does arbitrary character represent in sql?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!