SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create table t (id int primary key auto_increment, num int); insert into t(num) values (1), (2), (3), (2), (3), (4), (5), (6), (5), (4), (7); with d as ( select id, num, lag(num) over W as prev_num, lead(num) over W as next_num from t window w as (order by id asc) ) select id, num from d where prev_num > num and next_num > num;
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear