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
create table products ( id int primary key generated always as identity, name text ); insert into products (name) values ('Товар 1'); create table products_photos ( id int primary key generated always as identity, product_id int references products (id), url text ); insert into products_photos (product_id, url) values (1, 'example1.png'), (1, 'example2.png'); select products.id, products.name, jsonb_agg(url) from products left join products_photos on products.id = product_id group by products.id, products.name

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

Copy Clear