Home > Database > SQL > How to use like in sql

How to use like in sql

hzc
Release: 2020-06-09 15:40:32
Original
20931 people have browsed it

How to use like in sql

Usage of like in sql:

The operator LIKE uses wildcards to compare a value with similar values. There are two wildcards:

1. Percent sign (%): represents zero, one or more characters

2. Underscore (_): represents a number or character

The condition matches any value that starts with 200

WHERE SALARY LIKE '200%'
Copy after login

The following condition matches any value that contains 200 (at any position)

WHERE SALARY LIKE '%200%'
Copy after login

The following condition matches the second and third characters that are 0 Value

WHERE SALARY LIKE '_00%'
Copy after login

The following condition matches values ​​that start with 2 and have a length of at least 3

WHERE SALARY LIKE '2_%_%'
Copy after login

The following condition matches values ​​whose second position is 2 and ends with 3

WHERE SALARY LIKE '_2%3'
Copy after login

Recommended tutorial: "sql tutorial"

The above is the detailed content of How to use like in sql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
sql
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
Latest Issues
sql file
From 1970-01-01 08:00:00
0
0
0
php - Overhead of prepare vs sql?
From 1970-01-01 08:00:00
0
0
0
Print sql statement
From 1970-01-01 08:00:00
0
0
0
Pass array to SQL insert query using PHP
From 1970-01-01 08:00:00
0
0
0
sql optimization or
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template