Search ⌘K
O
Oracle

Interview Core Track · Medium · 25 min

2. Designing Database for Oracle's Employee Training Program

Oracle is starting a new Employee Training Program and wants to keep track of each employee's progress. The program includes multiple courses, and each cours...

Interview Core Track
Medium
25 min
joins
aggregation
filtering

Company labels are directional practice context, not official interview guidance.

Timer 00:00
Back to practice

Objective

Practice joins through a Oracle-tagged business scenario.

Approach

Use this track to improve speed, edge-case handling, and accuracy under timed conditions.

Company context

Company labels are directional practice context, not official interview guidance.

Prereq: query basics
Prereq: filtering

Oracle is starting a new Employee Training Program and wants to keep track of each employee's progress. The program includes multiple courses, and each course may consist of several modules. Every employee can take various courses and complete the modules at their own pace. Once an employee completes a module, their completion status and date are recorded. We need a database system to track this information and provide insights on the overall effectiveness of the program. Design a database for tracking this scenario. Also, **write a SQL query that will generate a report showing the total number of courses every employee has completed.** Assume the following example data for Employee, Course, Module and EmployeeModule tables. Employee Table: employee_id name department ------------------------------- 1 John Marketing 2 Sara Sales 3 Bob HR Course Table: course_id name ------------------------------------ 1 Communication Skills 2 Leadership Development 3 Team Building Module Table: module_id name course_id ---------------------------------------------- 1 Effective Communication 1 2 Decision Making 2 3 Collaboration 3 EmployeeModule Table: employee_id module_id completed_date status ---------------------------------------------------- 1 1 2022-06-25 Completed 1 2 2022-07-01 Completed 1 3 2022-07-10 Completed 2 1 2022-06-20 Inprogress 3 2 2022-07-10 Completed **Answer:** SELECT e.name, COUNT(DISTINCT m.course_id) AS total_courses_completed FROM Employee e JOIN EmployeeModule em USING(employee_id) JOIN Module m USING(module_id) WHERE em.status = 'Completed' GROUP BY 1 ---

Employee
employee_id INT PRIMARY KEY
name VARCHAR(100
Course
course_id INT PRIMARY KEY
name VARCHAR(100
Module
module_id INT PRIMARY KEY
name VARCHAR(100
EmployeeModule
employee_id INT REFERENCES Employee(employee_id
Editor
SQL workspace

Run queries against the protected question data, then submit once the result shape looks right.

Sign in to run SQL

Create a free account or sign in before running queries against protected question data.