Hello everyone I'm having problems with this assignment from school I hope anyone could help me. I'm going to leave the script here so you guys can see what i can see.
here are the instructions
For all departments that have more than 3 different products (toy names)
list the department name and the number of toys.
here what i tried
select d_name, quantity FROM departments d, toys t group by dept having count(dept) > 3;
here is another instruction
Find and list all employees whose department sells toys with a retail cost
of more than $25.00. Use a subquery to find all departments with r_cost
> 25.00. Your output should include employee full name (combine first
& last name) and the department name.
Hint: you'll need a join between employee and department to get the
department name; use this and a subquery finding all toys with r_cost
here is what i've tried
SELECT CONCAT_WS(" ", `fName`, `lName`), d_name FROM employees e, departments d, toys t WHERE e.department = d.d_id and
t.r_cost = (SELECT r_cost FROM toys WHERE r_cost > 25 limit 1);
here is the last instruction
Delete all departments that have no employees. To prove your results list
the output from SELECT * FROM departments before and after the
Hint: I would recommend you make a copy of your department table
prior to executing (CREATE TABLE my_departments SELECT *
FROM departments, just in case.