Resolved: why this code is not valid
in SQL / Using SQL views
create view average_salaryy as
select avg(s.salary) as total_Salary
from dept_manager d
join salaries s on d.emp_no = s.emp_no
where salary = (select sum(s.salary) from salaries);
1 answers ( 1 marked as helpful)
Thanks for reaching out.
You do not need to assign the sum of the salaries. You need to simply join the tables and use the
AVG() aggregate function.
Please, use the following code:
CREATE VIEW average_salaryy AS
AVG(s.salary) AS total_Salary
salaries s ON d.emp_no = s.emp_no;
Hope this helps.
Submit an answer
Why did you not do not null, primary key and auto increment for customer id in the solution?
The schema section does not show the tables in the Tables subsection.