#50 Finding Employee Contacts
Find all employees who have at least one contact starting with the letter A and no contacts starting with the letter B.
CREATE TABLE Employee (
id INT PRIMARY KEY AUTO_INCREMENT, -- Employee identifier, primary key with auto-increment
name VARCHAR(255) NOT NULL -- Employee name, required field
);
CREATE TABLE Contact (
id INT PRIMARY KEY AUTO_INCREMENT, -- Contact identifier, primary key with auto-increment
employee_id INT, -- Foreign key referencing the Employee table
contact VARCHAR(255) NOT NULL, -- Contact information, required field
FOREIGN KEY (employee_id) REFERENCES Employee(id) -- Foreign key definition
);
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