mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 01:12:12 +00:00
21 lines
462 B
Plaintext
21 lines
462 B
Plaintext
|
-- { echo }
|
||
|
|
||
|
-- create table
|
||
|
drop table if exists test;
|
||
|
create table test(`a` Nullable(Int32), `b` Nullable(Int32)) ENGINE = Memory;
|
||
|
insert into test (a,b) values (1,null), (2,3), (4, 5), (6,null);
|
||
|
-- first value
|
||
|
select first_value(b) from test;
|
||
|
3
|
||
|
select first_value(false)(b) from test;
|
||
|
3
|
||
|
select first_value(true)(b) from test;
|
||
|
\N
|
||
|
-- last value
|
||
|
select last_value(b) from test;
|
||
|
5
|
||
|
select last_value(false)(b) from test;
|
||
|
5
|
||
|
select last_value(true)(b) from test;
|
||
|
\N
|