#390 Departments with a Small Number of Employees
Display the departments whose employee count does not exceed three:
- Department:
CREATE TABLE department (
id INTEGER NOT NULL, - department identifier
name VARCHAR(128) NOT NULL, - department name
PRIMARY KEY (id)
);
- Employee:
CREATE TABLE employee (
id INTEGER NOT NULL, - employee identifier
department_id INTEGER NOT NULL, - department identifier
manager_id INTEGER, - manager identifier
name VARCHAR(128) NOT NULL, - employee name
salary DECIMAL NOT NULL, - employee salary
PRIMARY KEY (id),
FOREIGN KEY (department_id) REFERENCES department(id),
FOREIGN KEY (manager_id) REFERENCES employee(id)
);
Question review
Sign in to start the dialogue
The mentor keeps the context of the current question and your previous messages.
Sign in
Available with Premium
This is just one of the solutions available with Premium. And more:
- 250+ advanced lectures
- 1300+ practice exercises
- 500+ solutions to problems from real interviews
- Personalized Java Hub certificates
- Expanded access to the AI mentor