Design an online learning database like Udemy
PremiumDatabase designMedium
- Content hierarchy
- Completion tracking
- Certificates
Quick answer
This database design interview question asks you to design an online learning database like Udemy. Aim for a design that stores data correctly and serves its main queries well, then explain the schema, keys, indexes and trade-offs. Interviewers want to see how you model entities, choose keys and design for the real access patterns.
The problem
Design the database for an online learning platform like Udemy. Instructors publish courses of sections and lectures; students buy a course once, keep lifetime access, complete lectures, take quizzes and earn certificates. The hard part is that instructors keep editing courses after students have bought them.
Lectures are videos, articles or quizzes, and students often buy with a coupon. The app records which lectures each student has completed, shows percent complete per course, scores quiz attempts, and issues a certificate when a student finishes a course.
Students review courses they own, and instructors are paid a share of each sale monthly.
What must an online learning database like Udemy do?
- Buy: Purchase a course at the current price minus a coupon; a student cannot buy the same course twice; the purchase records the price paid and the instructor's share.
- Learn: Open a lecture only if the student is enrolled or the lecture is a free preview; mark a lecture complete when the student finishes it.
How well must it do it?
- Ownership is permanent: Once bought, access is never lost, even if the course price or content changes.
- Progress is exact: Percent complete reflects the current set of lectures; adding a lecture lowers a student's percentage, but a certificate already issued stays valid.
What scale should you design for?
Use these numbers in your estimates.
The scale numbers unlock with this questionUnlock
Key concepts
- Content hierarchy
- Completion tracking
- Certificates
- Revenue share
- Reviews aggregation
- Price snapshot
How you’ll practise
- Access patterns
- Entities
- Schema
- Indexes and queries
- Scale and consistency
- Wrap-up
Lala, personalized to you, gives a hint when you ask and reviews your design when you are ready.
What do interviewers look for?
In any database design round.
- Lists the entities and how they relate before writing tables
- Designs the schema around the main access patterns
- Chooses primary keys, foreign keys and indexes with reasons
- Explains where to normalise and where to denormalise
- Considers integrity, transactions and concurrent writes
- Plans for growth: partitioning, archiving and migrations
Questions people ask about this interview question
- Which design type is this question?
- It is a database design question. You design an online learning database like Udemy and explain your choices the way you would in an interview.
- Is this question asked at entry level?
- It is marked Medium. Entry-level engineers can practise it, but it expects you to reason about requirements and trade-offs, not only list components.
- What should I cover first?
- Start with the entities and the main queries the database must answer. Agree on scope with the interviewer before you design anything.
- Can I practise it for free?
- It is a premium question. Sign up and unlock it once for 10 credits; it then stays unlocked. When you finish, Lala, your personalized AI mentor, can review your design for 30 credits.
Related questions
Updated · Written by the SevyDevy team