Things to note about MySQL's varchar type, mysqlvarchar_PHP tutorial

WBOY
Release: 2016-07-12 09:03:38
Original
988 people have browsed it

Notes on MySQL’s varchar type, mysqlvarchar

I discovered such a problem at work a few days ago: when the type of a field is varchar, the value saved in the field is similar to '100, 200, 300' and '100' or '100,400'. You will make such mistakes when writing SQL statements, for example:

select id,provinceid from admin where provinceid in ('100'<span>);

select id</span>,provinceid from admin where provinceid in (100);
Copy after login

You will find that the query results of the above two SQLs are not the same, and the correct SQL is the second one. Because the values ​​stored in the field are similar to '100, 200, 300', not '100', '200', '300', the SQL in item 2 is correct.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1080759.htmlTechArticleNotes on MySQL’s varchar type, mysqlvarchar I discovered such a problem at work a few days ago: when a certain field When the type is varchar, the value stored in the field is similar to '100, 200, 300...
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