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 tableA (id int, val int, month text, index(id)); insert into tableA values (1,10,"2023-10"),(1,10,"2023-10"),(1,10,"2023-11"),(2,5,"2023-10"),(2,3,"2023-10"),(2,6,"2023-11"); create table tableB ( id int primary key, val int, foreign key (id) references tableA(id) ); insert into tableA (id, val) select id, sum(val) from tableA group by id; select * from tableA;

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

Copy Clear