什么是此查询的输出以及为什么? [英] What is Output of This query and Why?
本文介绍了什么是此查询的输出以及为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
declare @table as table
(
id int identity(1,1)
,salary int
)
insert into @table values(1000)
insert into @table values(2000)
insert into @table values(5000)
insert into @table values(4000)
insert into @table values(1000)
insert into @table values(8000)
insert into @table values(9000)
insert into @table values(6000)
insert into @table values(1000)
insert into @table values(7000)
insert into @table values(3000)
select A.salary from @table as A
where (select count(*) from @table B
where b.salary < A.salary)>5
推荐答案
输出:
工资
-------
5000
8000
9000
6000
7000
说明:
下面的sql片段从临时表中选择单行。
Output:
salary
-------
5000
8000
9000
6000
7000
Explanation:
Below sql snippet selects single row from temp table.
select A.salary from @table as A
这里哪里condition是一个子查询。让我们签出这个子查询。
Here where condition is a sub query. Lets checkout this sub query.
select count(*) from @table B where b.salary < A.salar
此查询给出薪水大于 A 工资的人的计数。 br />
如果计数大于5,那么这些工资将被打印!
This query gives the counts of those whose salary is greater than the salaries of A.
If this count is greater than 5 then those salaries will be printed!
这篇关于什么是此查询的输出以及为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文