Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
drop table emp_input; create table emp_input ( id int, name varchar(40) ); insert into emp_input values (1, 'Emp1'); insert into emp_input values (2, 'Emp2'); insert into emp_input values (3, 'Emp3'); insert into emp_input values (4, 'Emp4'); insert into emp_input values (5, 'Emp5'); insert into emp_input values (6, 'Emp6'); insert into emp_input values (7, 'Emp7'); insert into emp_input values (8, 'Emp8'); select * from emp_input; with cte as ( select concat(id,' ',name) as id, ntile(4) over(order by id) as buckets from emp_input) select string_agg(id,', ') over(partition by buckets)from cte

Stuck with a problem? Got Error? Ask AI support!

Copy Clear