Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize Online / PHPize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear
CREATE TABLE Games (EntryFee INT, Rake INT, TotalEntry INT); CREATE TABLE Transaction1 (UserID VARCHAR(25)); INSERT INTO Games VALUES (30,16,150),(45,20,100),(15,5,50),(25,20,300),(10,8,270); INSERT INTO Transaction1 VALUES ('Daniel'),('David'),('John'),('Martha'); SELECT Games.EntryFee, Games.Rake, Games.TotalEntry, COUNT(distinct Transaction1.UserID) AS CountUser, (Games.EntryFee * Games.Rake / (100 + Games.Rake) * Games.TotalEntry / COUNT(distinct Transaction1.UserID)) AS Calculate FROM Games JOIN Transaction1 GROUP BY Games.EntryFee, Games.Rake, Games.TotalEntry;

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

Copy Clear