Home >Database >Mysql Tutorial >How to query statements starting with what characters in Mysql

How to query statements starting with what characters in Mysql

coldplay.xixi
coldplay.xixiOriginal
2020-11-13 11:02:2711873browse

mysql Query the statement starting with what character: 1. Use wildcard query, the code is [SELECT * FROM `article` where title like 'positive%';]; 2. Use the left function to query, the code is 【where left(title,1)】.

How to query statements starting with what characters in Mysql

mysql query statement method starting with what character:

#1: Use wildcards:

SELECT * FROM `article`
  where title like '正%';

2: Use the left function:

SELECT * FROM `article`
  where left(title,1)='正';

3: Use the string interception function:

SELECT * FROM `article`
  where substring(title,1,1)='正';

More related free learning recommendations: mysql tutorial(Video)

The above is the detailed content of How to query statements starting with what characters in Mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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

Related articles

See more