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 accounts( `id` bigint(20) UNSIGNED NOT NULL auto_increment, data varchar(36), `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ); insert into accounts(data, created_at, updated_at) values('Test 1', now(), now()); insert into accounts(data, created_at, updated_at) values('Test 2', now(), now()); insert into accounts(data, created_at, updated_at) values('Test 3', now(), now()); create table account_locks( account_id bigint(20) UNSIGNED NOT NULL, pid varchar(36), `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ); insert into account_locks set pid = UUID(), account_id = ( select id from (select id from accounts left join account_locks on account_id = accounts.id group by id having count(account_locks.account_id) < 3 limit 1) as t )

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

Copy Clear