Home > Database > SQL > body text

How to use like in sql

hzc
Release: 2020-06-09 15:40:32
Original
20823 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
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