One-to-many & Many-to-many
Daniel Trejo
Posted on August 1, 2024
Hello, my name is Daniel and I'm a student at flatiron. I am currently working through my project in phase-4 which is really challenging but I am learning a lot from all of it. One thing that screwed me over before and took me some time to understand was one-to-many and many-to-many. It took me way too long to understand what that meant and how it was supposed to work in my project. I understood a one-to-many a lot faster than I did a many-to-many because in my last project. I created and library management system and it allowed people to create authors and books using python.
Author was one and that books were the many. Each author had an infinite number of books they could have while a book could realistically only have one author. One(author)-to-many(books).
Now for many-to-many, we had to use both in phase 4 project and I went with a blog page ironically. Post was a one-to-many and so was the user but the comments was a many-to-many because it had both the posts and the user connected to it. It showed which post it was commented on using the posts id and then also showed who wrote the comment by showing the user's id when they comment. So that's a many-to-many and that took too long for me to understand.
Posted on August 1, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 29, 2024