Sobes.tech
Intern — Senior

Staff count by department

livecode

Task condition

Create a list of all departments, indicating the number of their employees. The final set should include only those departments that have a name.

CREATE TABLE departments (
    id INT PRIMARY KEY,
    name VARCHAR(100) NOT NULL
);

CREATE TABLE employees (
    id INT PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    department_id INT,
    FOREIGN KEY (department_id) REFERENCES departments(id)
);