where後面的行子查詢使用

2021-10-09 22:15:25 字數 633 閱讀 3743

行子查詢(結果集一行多列或多行多列)

案例:查詢員工編號最小並且工資最高的員工資訊

select *

from employees

where (employee_id,salary)=(

select min(employee_id),max(salary)

from employees

);1.查詢員工編號最小

select

min(employee_id)

from employees;

2.查詢最高工資

select

max(salary)

from employees;

3.查詢員工資訊

select

*from employees

where employee_id =

(select

min(employee_id)

from employees;

)and salary =

(select

max(salary)

from employees;

);

090 where後面的行子查詢

查詢員工編號最小並且工資最高的員工資訊 此員工不一定存在 以前的做法 select from employees where employee id select min employee id from employees and salary select max salary from emp...

089 where後面的列子查詢

多行子查詢 多行比較操作符 innot in anysom allin 與 any 等價 not in 與 all 等價 返回location id是1400或1700的部門中的所有員工姓名 1產尋location是1400 1700的部門編號 select distinct department ...

HiveQL中where後面的and 和or 處理

昨天我在嘗試寫乙個很簡單的hiveql 語句如下 select a.ver,a.vid,a.wid,a.type,count from select stat date,ver,get json object json,vid as vid,get json object json,wid as w...