44 lines
705 B
SQL
44 lines
705 B
SQL
create schema raw;
|
|
create schema core;
|
|
create schema dm;
|
|
|
|
create table raw.users(
|
|
id INT,
|
|
name varchar(50),
|
|
age INT,
|
|
email varchar(50),
|
|
registration_date date
|
|
)
|
|
distributed by (id);
|
|
|
|
create table raw.courses (
|
|
id INT,
|
|
title text,
|
|
category varchar(40),
|
|
created_at date
|
|
)
|
|
distributed by (id);
|
|
|
|
create table raw.lessons (
|
|
id INT,
|
|
course_id INT,
|
|
title TEXT,
|
|
duration_min INT
|
|
)
|
|
distributed by (course_id);
|
|
|
|
create table raw.enrollments (
|
|
id INT,
|
|
user_id INT,
|
|
course_id INT,
|
|
enrolled_at date
|
|
)
|
|
distributed by (user_id);
|
|
|
|
create table raw.lessons_views(
|
|
id int,
|
|
user_id int,
|
|
lesson_id int,
|
|
viewed_at timestamp
|
|
)
|
|
distributed by (user_id) |