当前位置:网站首页>mysql的tinyint字段类型判断的疑惑
mysql的tinyint字段类型判断的疑惑
2022-06-25 03:54:00 【CSDN问答】
今天在写SQL语句是,where条件中使用了一个tinyint类型的字段做判断,自己没有留意写错了判断值,神奇的是竟然能查到数据
以下是表和对应的SQL语句
CREATE TABLE `test` ( `id` int(10) NOT NULL AUTO_INCREMENT COMMENT 'id', `type` tinyint(4) NOT NULL COMMENT '类型', `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT '名称', PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;INSERT INTO `test`(`id`, `type`, `name`) VALUES (1, 0, '名称0');INSERT INTO `test`(`id`, `type`, `name`) VALUES (2, 1, '名称1');INSERT INTO `test`(`id`, `type`, `name`) VALUES (3, 2, '名称2');INSERT INTO `test`(`id`, `type`, `name`) VALUES (4, 0, '名称4');执行下面的两条SQL语句,得到的结果竟然是一样的
select * from test where type = 'type ';select * from test where type = 0;| id | type | name |
|---|---|---|
| 1 | 0 | 名称0 |
| 4 | 0 | 名称4 |
在网上找了没有看到类似的问题,请教各位,这是什么原因呢?
边栏推荐
- Work assessment of Biopharmaceutics of Jilin University in March of the 22nd spring -00031
- "Comment positionner l'industrie" dans la planification industrielle locale / parc
- Cesium graphic annotation circle, square, polygon, ellipse, etc
- 1. first knowledge of chromatic harmonica
- "How to carry out industrial positioning" in local / Park industrial planning
- MySQL modifies and deletes tables in batches according to the table prefix
- Crawler grabs the idea of reading on wechat
- 【LeetCode】22. 括号生成
- Crawler crawls Sina Weibo data
- 2022-06-21-flink-49 (I. SQL manual)
猜你喜欢

Cesium graphic annotation circle, square, polygon, ellipse, etc

数字时代的“文艺复兴”?起底数字藏品,让人欢喜让人愁

"Comment positionner l'industrie" dans la planification industrielle locale / parc

How to use ide to automatically sign and debug Hongmeng application

acmStreamOpen返回值问题

代錶多樣性的彩色 NFT 系列上線 The Sandbox 市場平臺
Zoran community

SEO的5大关键指标:排名+流量+会话+停留时长+跳出率

【Proteus仿真】Arduino UNO按键控制数码管闪烁增/减显示

地方/园区产业规划之 “ 如何进行产业定位 ”
随机推荐
Intel 13代酷睿首次露出真面目:68MB缓存提升明显
client-go gin的简单整合十一-Delete
Teach you how to install win11 system in winpe
Jilin University 22 spring March "automatic control principle" work assessment-00050
Simple integration of client go gin -update
(ultra detailed onenet TCP protocol access) arduino+esp8266-01s accesses the Internet of things platform, uploads real-time collected data /tcp transparent transmission (and how to obtain and write Lu
SQL, CTE, FLG CASE问题
Crawl Sina Weibo fans
numpy np tips:使用opencv对数组插值放缩到固定形状 cv2.resize(res, dsize=(64, 64), interpolation=cv2.INTER_CUBIC)
2.吹响半音阶口琴
Comprehensive operation of financial risk management X of Dongcai
Zoran community
Crawler grabs the idea of reading on wechat
"Grammar sugar" -- my new programming knowledge
Turn 2D photos into 3D models to see NVIDIA's new AI "magic"!
Development of trading system (VI) -- HFT high frequency trading
Simple integration of client go gin 11 delete
La gamme NFT Color, qui représente la diversité, est en ligne sur la plate - forme du marché Sandbox
"How to carry out industrial positioning" in local / Park industrial planning
Smart wind power: operation and maintenance of digital twin 3D wind turbine intelligent equipment