“是什么意思”如果存在(从表t中选择top 1 null)" [英] what is the meaning of " if exists(select top 1 null from table t)"

查看:111
本文介绍了“是什么意思”如果存在(从表t中选择top 1 null)"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你的意思是什么意思?如果条件为真,它将返回什么?

什么是select top 1 null?

类似于选择记录,即使某些列具有空值也是为了防止省略该特定行?

请帮助我解答。

what do you mean by that statement? if the condition is true, what is it going to return?
what is select top 1 null?
is it something like selecting the records even if some columns have null values also in a row to prevent the omitting of that particular row?
kindly help me with your answers.

推荐答案

如果 row(s)出现在它返回的表中 true else false

AFAIK背后没有其他逻辑,经过测试。
If row(s) are present in the table it returns true else false
AFAIK no other logic behind, tested.


Karthik是对的。这只会检查表中是否有某些行。它具有与以下相同的效果:

Karthik is right. This only checks if there are some rows in the table or not. It has the same effect as:
if exists(select * from table)



该查询的作者只是尝试通过选择一行来智能并优化它。但实际上并不需要这样做,因为在这两种情况下查询计划完全相同。


The author of that query just tried to be smart and optimize it by only selecting one row. But this is actually not needed because in both cases the query plan is exactly the same.


这篇关于“是什么意思”如果存在(从表t中选择top 1 null)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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