SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE jobs ( job_id serial, job_title varchar(64) ); INSERT INTO jobs (job_title) VALUES ('SalesManager'), ('Cleaner'), ('OfficeManager'); CREATE TABLE employees ( id serial, job_id int, salary int ); INSERT INTO employees VALUES (1, 1, 10000), (2, 1, 20000), (3, 2, 20000), (4, 3, 20000), (5, 3, 5000); SELECT jobs.job_title, AVG(employees.salary) average_salary FROM employees JOIN jobs ON employees.job_id = jobs.job_id WHERE jobs.job_title Like '%Manager' GROUP BY jobs.job_title HAVING AVG(employees.salary) > 10000 ;
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear