#50 Finding Employee Contacts

Companies:
Unknown company
Themes:
SQLAggregationPractice

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

Mentor
Answer as you would in a real interview. I’ll ask follow-up questions, then compare your answer with the reference answer and show your accuracy as a %.
Sign in to start the dialogue The mentor keeps the context of the current question and your previous messages.
Sign in