1

In TSQL WHERE clause, does the Truth Table logic apply?

For instance I have the following code:

WHERE (@Flag = 0 AND Title LIKE '%...%') OR (@Flag = 1 AND Title = '...')

In case @Flag = 0, First () will be True and second () will be False. So True OR False would result in True, hence, the second () won't have an effect on the query result. Is that true?

Thanks

4

1 回答 1

4

是的,真值表适用于逻辑。

pqp 与 qp 或 q
TTTT
薄膜晶体管
薄膜晶体管
FFFF

因此,当p为真和q为假时,p OR q将评估为真。

正如所建议的,还值得一看3 值逻辑


(来源:wikimedia.org

于 2013-01-26T15:22:10.833 回答