Database Design for Facebook: A Social Network Database Example

preview_player
Показать описание

Are you interested in designing a database for a social network, like Facebook?

Facebook is a popular website and designing a database for a site like Facebook is a common exercise, whether you're in a database course at college or want to practice your skills.

In this video, you'll start with a series of basic features of the system, and one-by-one we'll create a database design, adding to the design at each step.

The final design will meet the requirements of the features we have identified.

You can then expand on the design, and of course modify it if you want different requirements.

A couple of links mentioned in this video:

Timestamps:
00:00 Start
00:52 Features
01:39 Feature 1 - create profile
04:08 Feature 2 - add other profiles
05:41 Feature 3 - add posts
07:09 Feature 4 - see posts
07:31 Feature 5 - likes and comments on posts
08:49 Final design
09:51 Sample queries
Рекомендации по теме
Комментарии
Автор

Oh my god this is a life saving video. Youve saved me so much time. Got yourself another subscriber.

--__--
Автор

Very nice video. Never really made sense how to implement the friend relationship until now.

tylercondon
Автор

What would happen if we had billions of posts, and want to see the posts of a certain profile, wouldn't it take ages to get them? What is the solution?

Incnoun
Автор

But how would this work when you social media app grows to a million people? Databases will become so large that this is not sufficient for querying, and you need graphs in some way. That's what I've always been wondering, how do the large social media apps manage that?

StepwaveMusic
Автор

How to make data enter from multiple devices into a single database? What is the best software for this? Very good video!

Odyssey
Автор

I am currently using Mysql. Can you please suggest me which database will be best for this? I am concerned about the scalability and also speed.

roshedulalamraju
Автор

Would be interesting to see how you would create the table setup for groups

fredoscott
Автор

Great tutorial! Thanks for this video. It's so helpful and helps me a lot.

lenguyenminhtan
Автор

For the friendship, why not have a table with “Owner” | User_Profile and “Friends” | List of User_Profile? Or is that not how list work?

ShawnRay
Автор

thank you very much Ben, but I think extracting a list of data (posts for example) through database each time a user load a page is time consuming, isn't it?

javadmoeinihadizadeh
Автор

while watching this video I am writing my own database for my portfolio website and
also I need help for the table which I don't understand quite well at the 5:00 add other profiles

additional question:
where can i contact you?

sphinxz_gaming
Автор

Hi Ben, loving your videos, I have been on a binge for the past few days. I have a video request / idea you may find interesting: Most SQL tutorials / articles online have typical database design tutorials like how to do social media, or ecommerce, but seldom have I seen db designs for things like Trello. How would one go about it? We would have to keep a track of the order of the elements in the card, allow for user generated custom fields within the cards. Was wondering if you could shed some light on it.

devanshusinha
Автор

With step 3, what are the pros and cons of the two options you mentioned: separate tables for different types of posts vs one table with several attributes?

nicholassmith
Автор

Hi, I am new to a database design. The post_like ❤ table and post_comment 💬 table connected the same way to user_profile 👤 table and user_post 📋 table, but for post likes there can be only one like per post for a user and for post comments there can be many comments per user. How come? 😮

ker
Автор

This was so helpful. Thank you so much! My question is does MySQL (relational DB) have any advantages over MongoDB (document DB) for a social network? (Of course that depends on the complexity of features because I know that Mongo would be better for one-to-many relationships but SQL provides better support for joins and is better at many-to-many relationships. But if we're just talking about the simple features like in the video without finding mutual friends where the data would have to be highly interconnected, which would probably require a graph database, which database would you rather use a MySQL or MongoDB for a project like this and which one would scale better for millions of users? Thank you so much in advance, I'm just really curious about this

madrussian
Автор

great video, I have a question tho in the relation between user_profile and post_like should't the association be one-to-one instead of one-to-many since a user can make only one like for a given post

marufbelete
Автор

I think for this type of system we should use document oriented db

basheeral-momani
Автор

Hi, I am new to database design. I just want to ask about scalability. I mean in this database design, you use a table to store videos /image/text. I read some documents saying that with SQL, there is a limited amount of data that could store in each table. What if the size of videos/image/text is too large?

MinhNguyen-ultk
Автор

So useful! Your videos are very insightful and are really helping me. Thank you

nicholassmith
Автор

Hey sir great tutorial! Which program or website did you use in this video?

burakkaraduman