Basic Database Design: List of Type Instances
This is a beginner's question about database design. Let's say we have a blog blog with many users, each with multiple blog posts. We want to quickly find all articles written by a given user. We could search the post table for all blog posts with a given user id. We could also design a user table to have a list of user posts. This would mean perhaps storing a comma-separated string of message IDs. What is the correct way to do this?
0
source to share
1 answer
Reservation (storing the same data more than once) Anomalies (changing one binding changes another) Cycles (changing A changes B, which changes C, which changes A) Redesign (adding or removing a field requires changing other fields) Offsets (different ways ask the same question give different answers)
Users
userID other user fields ..
100 Charlie
101 Edith
Articles
articleID userID pathOrWhatever...
1000 100 http://example.com/stuff
1001 100 http://example.com/moreStuff
1002 101 http://example.com/somethingElse
This project can get articles from users or from users from articles from database commands.
+3
source to share