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 block ( id int generated always as identity primary key, "name" text, "position" smallint ); create table block_variants ( id int generated always as identity primary key, block_id int references block (id), "text" text ); insert into block ("name", "position") values ('приветствие', 1), ('основной текст', 2), ('завершение', 3); insert into block_variants (block_id, "text") values (1, 'Привет тебе'), (1, 'Здрасьте'), (2, 'Увеличьте пенис'), (2, 'Вы выиграли миллиард'), (3, 'Пока'), (3, 'До свидания'); select distinct on (block_id) id, block_id, "text" from block_variants order by block_id, random();

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

Copy Clear