Knowledge Guide
HomeDatabasesSQL Practice Problems

easy High Performing Employees

Problem Statement

Table: Employee
Each row in this table represents an individual employee, detailing their unique ID, name, department they belong to, and their salary.

+-------------+---------+
| Column Name | Type    |
+-------------+---------+
| empId       | int     |
| name        | varchar |
| department  | varchar |
| salary      | int     |
+-------------+---------+
empId is the primary key for this table.
Each row of this table contains information about an employee, including their name, department, and salary.

Table: Performance

+-------------+------+
| Column Name | Type |
+-------------+------+
| empId       | int  |
| rating      | int  |
+-------------+------+
empId is the primary key for this table.
empId is a foreign key referencing the empId column of the Employee table.
Each row of this table contains the performance rating (an integer value) of an employee.

Problem Definition

Write an SQL query to find the names of employees with a performance rating above 8. Return the result table in any order.

The query result format is in the following example:

Example

Input:

Employee table:
+-------+---------+-------------+--------+
| empId | name    | department  | salary |
+-------+---------+-------------+--------+
| 1     | Alice   | HR          | 70000  |
| 2     | Bob     | Engineering | 80000  |
| 3     | Charlie | HR          | 60000  |
| 4     | David   | Engineering | 90000  |
+-------+---------+-------------+--------+
Performance table:
+-------+--------+
| empId | rating |
+-------+--------+
| 1     | 9      |
| 2     | 8      |
| 3     | 7      |
| 4     | 9      |
+-------+--------+

Output:

+---------+
| name    |
+---------+
| Alice   |
| David   |
+---------+

Only Alice and David have performance rating above 8.

Try It Yourself

java
-- TODO: Write your user queries here

Solution

To solve this problem, we need to identify employees in the Employee table who have a performance rating higher than 8. We will use SQL query to join the Employee table with the Performance table and filter the employees based on their performance rating.

  1. Join Employee and Performance tables: Begin by executing a SELECT statement to join the Employee and Performance tables on the empId column.
  2. Filter by Performance Rating: Introduce a WHERE clause to filter out employees with a performance rating higher than 8.

SQL Query

The SQL query to achieve this is as follows:

SELECT e.name FROM Employee e JOIN Performance p ON e.empId = p.empId WHERE p.rating > 8;

Step by Step Approach

Step 1: Join Employee and Performance Tables

Initiate the process by joining the Employee and Performance tables on the empId column. Select the name column only after joining both tables.

SELECT e.name FROM Employee e JOIN Performance p ON e.empId = p.empId

Output After Step 1:

+---------+
| name    |
+---------+
| Alice   |
| Bob     |
| Charlie |
| David   |
+---------+

Step 2: Filter by Performance Rating

Refine the selection by applying a condition to filter out employees with a performance rating higher than 8.

SELECT e.name FROM Employee e JOIN Performance p ON e.empId = p.empId WHERE p.rating > 8;

Final Output:

+-------+
| name  |
+-------+
| Alice |
| David |
+-------+
🤖 Don't fully get this? Learn it with Claude

Stuck on High Performing Employees? Open Claude, copy a block below, and it'll teach you this exact concept — visually and interactively.

🪜 Hint ladder (no spoilers)

Progressively stronger hints — you still solve it.

I'm working on the problem **High Performing Employees** (Databases). Give me a HINT LADDER: start with the tiniest nudge, then wait. Only reveal the next, stronger hint when I ask. Do NOT show the full solution unless I type 'show solution'. Keep me doing the thinking. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🎨 Explain the approach visually

See the technique, not just code.

Explain the optimal approach to **High Performing Employees** with a VISUAL walkthrough: trace it on a small concrete example using ASCII art / a step-by-step diagram, narrate what changes each step, then give time & space complexity with a one-line derivation. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🔍 Review my solution

Catch bugs, edge cases, sub-optimality.

I'll paste my solution to **High Performing Employees**. Review it for correctness, missed edge cases, and time/space complexity, then coach me toward the optimal — don't just rewrite it. Ask me to paste my code now. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🔁 Drill the pattern

Lock in recognition with look-alikes.

Give me 2 problems that use the SAME underlying pattern as **High Performing Employees**. For each, let me attempt first, then review my answer and name the trigger signal that reveals the pattern. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.

📝 My notes