从表格中选择*,其中3> 2什么会返回此查询? [英] select * from table where 3 > 2 what will return this query?

查看:68
本文介绍了从表格中选择*,其中3> 2什么会返回此查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





从表中选择*,其中3> 2什么会返回此查询?任何人解释这个查询??

Hi,

select * from table where 3 > 2 what will return this query? anyone explain this query??

推荐答案

以下WHERE关键字是一个逻辑表达式,也称为谓词。



谓词计算为SQL逻辑值 - true,false或unknown。最基本的谓词是比较:



color =''Red''



这个谓词返回:

true - 如果颜色列包含字符串值 - ''Red'',

false - 如果颜色列包含另一个字符串值(不是' 'red'')或

unknown - 如果color列包含null。



在您的查询中,谓词3> 2始终为true ..由于没有其他条件存在,查询将从表中获取所有行。希望这能解释......
Following the WHERE keyword is a logical expression, also known as a predicate.

The predicate evaluates to a SQL logical value -- true, false or unknown. The most basic predicate is a comparison:

color = ''Red''

This predicate returns:
true -- if the color column contains the string value -- ''Red'',
false -- if the color column contains another string value (not ''Red''), or
unknown -- if the color column contains null.

In your query the predicate 3 > 2 is always true.. As no other condition is present the query will fetch all the rows from the table. Hope this explains...


3> 2总是如此。它会在您执行时显示所有行。同样5> 2,6> 1等

但如果你尝试使用2> 3,你不会得到任何结果,因为它总是假的。

正如你提到的只有一个条件条款。



谢谢
3 > 2 is always true. It will display all the rows when you execute. likewise 5 > 2 , 6 > 1 etc.
But if you try with 2 > 3, you will not get any results as it is always false.
As you mentioned only one conditional clause .

Thank you


用于过滤所有数据的位置。

这里条件3> 2总是正确的。这意味着条件总是正确的,没有其他条件过滤器。



*所以,它与TableName中的Select *类似。



- 全部返回记录 -
Where is used to filter the from all the data.
Here the condition 3>2 always true.It means condition is always true & no other conditions are there to filter.

*So, It works similar as Select * from TableName.

-- Returns All records --


这篇关于从表格中选择*,其中3> 2什么会返回此查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆