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 users ( id int primary key auto_increment, name varchar(255) unique ); create table chats ( id int primary key auto_increment ); create table chat_user ( id int primary key auto_increment, user_id int, chat_id int, foreign key (user_id) references users(id), foreign key (chat_id) references chats(id) ); select ch1.chat_id from chat_user ch1 join chat_user ch2 using (chat_id) where ch1.user_id = 1 and ch2.user_id = 2;

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

Copy Clear