
Joins and Relationships
Lesson 5 - Subqueries & CTEs Theory + Practice | StreamDB - Indian Streaming Platform Before You Start This lesson introduces StreamDB - a Hotstar-style streaming platform. Run setup.sql to create and populate StreamDB Verify you see 6 tables with the correct row counts Connect to streamdb in pgAdmin before running any query The StreamDB schema: users shows genres ┌────┬───────┬──────┐ ┌────┬────────┬──────────┐ ┌────┬──────────┐ │ id │ name │ plan │ │ id │ title │is_premium│ │ id │ name │ └────┴───────┴──────┘ └────┴────────┴──────────┘ └────┴──────────┘ │ │ │ │ │ show_genres │ │ │ ┌──────────────┘ ┌────────────┘ │ │ show_id | genre_id │ │ └──────────────────────────┘ (many-to-many) │ subscriptions watch_history ┌────┬─────────┬──────────────┐ ┌────┬─────────┬─────────┬─────────┐ │ id │ user_id │ plan │ │ id │ user_id │ show_id │ minutes │ │ │ │ started_on │ │ │ │ watched │ watched │ │ │ │ expires_on │ └────┴─────────┴─────────┴─────────┘ └────┴─────────┴──────────────┘ What you will learn: ...





