What cannot be represented by % in mysql

下次还敢
Release: 2024-04-27 07:24:12
Original
888 people have browsed it

In MySQL, % does not represent a decimal. It is a wildcard character that can match any number of any characters, but cannot be used to represent decimals. To match decimals, use the BETWEEN operator or comparison operators such as >= and <=.

What cannot be represented by % in mysql

In MySQL, what can't % mean?

In MySQL, % does not represent a decimal.

Detailed description:

In MySQL, % is widely used for wildcard matching and can match any number of any characters. For example:

  • LIKE '�c%' matches any string that contains the "abc" substring.
  • WHERE name LIKE 'J%' Matches all names starting with the letter "J".

However, % cannot be used to represent decimals. Therefore, the following query will not work correctly:

<code class="sql">SELECT * FROM table WHERE price = 10.5%;</code>
Copy after login

To match decimals, use the BETWEEN operator or comparison operators like >= and <code><= . For example:

SELECT * FROM table WHERE price BETWEEN 10 AND 11;
SELECT * FROM table WHERE price >= 10.5;

The above is the detailed content of What cannot be represented by % 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!