Reputation: 1092
I'm new to web design and I am making a niche social media site. I just want some general advice on the best way to design SQL database. I am using my sql and currently plan on having a profile table, that stores basic profile information (username, password, random other facts like location).
My question is can a cell serve as it's own separate table? I'm imagine each profile row will have a friends table inside of it that list all of the friends for that profile.
Is this the right way to go about designing? While not likely, i'd like a design good enough to scale in case I get thousands of users. Any advice would be greatly appreciated.
Upvotes: 0
Views: 49
Reputation: 38364
My question is can a cell serve as it's own separate table?
By "cell" I assume you mean a single value in a row. You cannot nest another table inside a row value. You could do something similar using an XML value, but more than likely what you are trying to accomplish is easily done using a foreign key in the friends table which references the primary key of the parent profile row. This known as normalization.
As for your other questions, those are too broad to be appropriate here. You should read through a basic tutorial/primer on database design. There are mountains of content someone could fill an answer with just to cover the basics of database design. "Database Normalization" and "database design best practices" are good starting Googles.
Upvotes: 4