日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

const mysql_mysql – 为什么我在解释查询中读取const表后会注意到“不可能”?

發布時間:2025/3/19 70 豆豆
生活随笔 收集整理的這篇文章主要介紹了 const mysql_mysql – 为什么我在解释查询中读取const表后会注意到“不可能”? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

我在表中有一個像fr(fromid,toid)這樣的唯一復合鍵,當我使用explain運行查詢時,我得到以下結果:

Impossible WHERE noticed after reading const tables`

我跑的查詢:

explain SELECT rid FROM relationship WHERE fromid=78 AND toid=60

有幫助嗎?

EDIT1:

當我使用以下查詢時:

explain SELECT rid FROM relationship WHERE fromid=60 and toid=78 AND is_approved='s' OR is_approved='f' OR is_approved='t'

我看到USING WHERE而不是上一條消息,但是當我使用下面的查詢時:

explain SELECT rid FROM relationship WHERE fromid=60 and toid=78 AND (is_approved='s' OR is_approved='f' OR is_approved='t')

我再次得到第一個不可能的消息!這些括號在這里做什么?

EDIT2:

CREATE TABLE `relationship` (

`rid` int(10) unsigned NOT NULL AUTO_INCREMENT,

`fromid` mediumint(8) unsigned NOT NULL,

`toid` mediumint(8) unsigned NOT NULL,

`type` tinyint(3) unsigned NOT NULL,

`is_approved` char(1) NOT NULL,

PRIMARY KEY (`rid`),

UNIQUE KEY `fromid` (`fromid`,`toid`),

KEY `toid` (`toid`),

CONSTRAINT `relationship_ibfk_1` FOREIGN KEY (`fromid`) REFERENCES `user` (`uid`) ON DELETE CASCADE ON UPDATE CASCADE,

CONSTRAINT `relationship_ibfk_2` FOREIGN KEY (`toid`) REFERENCES `user` (`uid`) ON DELETE CASCADE ON UPDATE CASCADE

) ENGINE=InnoDB

Impossible WHERE noticed after reading const tables

MySQL has read all const (and system) tables and notice that the WHERE

clause is always false.

但是在查詢中我得到了我想要的結果,WHERE部分不是假的.是否有人可以解釋這一點,并闡明這個問題?

總結

以上是生活随笔為你收集整理的const mysql_mysql – 为什么我在解释查询中读取const表后会注意到“不可能”?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。