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 person ( id integer, name text, section text, PRIMARY KEY (id) ); create Table fruit ( id integer, name text, personid integer, PRIMARY KEY (id), FOREIGN KEY (personid) REFERENCES person(id)); insert into person values (1, 'ВАНЯ', '1 отдел'), (2, 'Петя', '2 отдел'), (3, 'Коля', '3 отдел'); Select * from person; insert into fruit values (1, 'БАНАН', 1), (2, 'БАНАН', 1), (3, 'ЯБЛОКО', 2); Select * from fruit; select person.section, count(person.id) from person JOIN fruit ON person.id=fruit.personid GROUP BY person.section;

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

Copy Clear