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_name AS DEPARTMENT, CAST(MIN(e.salary) AS DECIMAL(10, 2)) / CAST(MAX(e.salary) AS DECIMAL(10, 2)) AS SALARY_DIFF_RATIO FROM your_department_table d -- Replace with your actual department table name JOIN your_employee_table e ON d.department_id = e.department_id -- Adjust join condition as necessary GROUP BY d.department_name HAVING MAX(e.salary) > 0 -- To avoid division by zero ORDER BY SALARY_DIFF_RATIO DESC, d.department_name ASC; ; SELECT 'Last_query_cost' AS "Variable_name", 0 AS "Value" FROM RDB$DATABASE;

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

Copy Clear