Consider an online video-sharing platform like YouTube which hosts tens of thousands of channels and crores of users.
The sample database consists of tables that store the information of users, channels, videos, genres and likes/dislikes.
Note:
channel_iduser_idsubscribed_datetime10012020-12-10 10:30:4510072020-10-10 11:30:45.........
channel_usertable stores the data of the channel_ids and their subscribers' user_ids.First row in the table represents that the user with user_id = 1 is subscribed to the channel with channel_id = 100 at
user_idvideo_idreaction_typereacted_at110LIKE2020-12-10 10:30:45710DISLIKE2020-10-10 11:30:45............
Similarly,
video_idgenre_id1020110202......
Similarly,
I CAN EXPLAIN QUESTION CLEARLY....
CREATE TABLE IF NOT EXISTS `Youtube`.`user_likes` (
`user_id` INT NOT NULL,
`video_id` INT NOT NULL,
`reaction_type` VARCHAR(45) NOT NULL,
`reacted_at` DATETIME NOT NULL,
PRIMARY KEY (`video_id`))
ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS `Youtube`.`video_genre` (
`video_id` INT NOT NULL,
`genre_id` INT NOT NULL,
PRIMARY KEY (`genre_id`))
ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS `Youtube`.`channel_user` (
`user_id` INT NOT NULL,
`channel_id` INT NULL,
`subscribed_date` DATE NOT NULL,
`Time` TIME NOT NULL,
PRIMARY KEY (`user_id`))
ENGINE = InnoDB;
Comments
Leave a comment