Home > Database > Mysql Tutorial > body text

How to query statements starting with what characters in Mysql

coldplay.xixi
Release: 2020-11-13 11:02:27
Original
11820 people have browsed it

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 '正%';
Copy after login

2: Use the left function:

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

3: Use the string interception function:

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

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!

Related labels:
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