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
SELECT d.DEPARTMENT, MIN(e.SALARY) / NULLIF(MAX(e.SALARY), 0) AS SALARY_DIFF_RATIO FROM DEPARTMENT d JOIN EMPLOYEE e ON d.DEPT_NO = e.DEPT_NO GROUP BY d.DEPARTMENT ORDER BY SALARY_DIFF_RATIO DESC, d.DEPARTMENT;

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

Copy Clear