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 orders ( id int, name varchar(255) ); create table order_product ( id int, order_id int references orders(id), importance tinyint ); insert into orders values (1, 'Order1'), (2, 'Order2'); insert into order_product values (1, 1, 0), (2, 1, 0), (3, 1, 1), (4, 1, 1); select * from orders where exists (select 1 from order_product where order_id = orders.id and importance = 0);

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

Copy Clear