Many to many relationships in MySQL

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


💬 Follow PlanetScale on social media
Рекомендации по теме
Комментарии
Автор

Thanks Aaron!
I don't even use Planetscale or MySQL, but these videos are honestly the best SQL-DB related content on YouTube.
It really takes a lot of presentation skills to make these videos that informative and entertaining.
Keep it up!

dumboluzz
Автор

Great video! Please, because these videos are related put a part 1, 2, and 3 on the title for future users to find them easily.

vasiovasio
Автор

There's even more benefits to this that, IMO, make it simply the best option. One is the lack of data duplication in the DB. Since we're doing this in a very normalized and RDBMS-friendly way we're really storing the minimum amount of data to make it work. The JSON method has a ton of repeated data, stored as strings. You might see "dark mode": true for thousands of rows. Another benefit is data integrity. Leveraging the DB to enforce a schema is usually the correct choice. We can't insert a flag that doesn't exist, we can't insert for a user that doesn't exist. With JSON there's nothing stopping garbage data from being inserted, leading to silent bugs. The application then has to enforce the schema... programmatically. "dar mode": true is just a bit too easy to slip by.

lucass
Автор

PlanetScale is becoming the gold standard of SQL tutorials. Did not see that coming!

charlesbcraig
Автор

ive just binged watched almost all your videos, im going to do your course next, thanks for doing this

zhanezar
Автор

Is there any downside of not having the `id` column on the lookup table and instead having [`user_id` and `flag_id`] being a primary key?

batvetone
Автор

Youtube started recommending me videos with Aaron in the Laravel channel too lol

adrianorocha-dev
Автор

Brilliant as always. I'm a big fan of many to many like this, so flexible. But I do also like the json method for some stuff too. Bitwise is just too mathy lol.

chrispian
Автор

I really appreciate your videos like this!

isaacferreira
Автор

Your only video that gives me an in-depth understanding of SQL and stuffs. I just wish you can do a full tutorial on MySQL 😊

thedelanyo
Автор

Linking tables are very useful for course enrolment system (student-course, teacher-course, room-course, .certificate_template-course ..) just to name a few example of many to many relationships.

I was always call it a Linking table until I read somewhere that it's called a Bridge table. the same meaning though.
Thanks Aaron!

ahmad-murery
Автор

Props to the ORMs for abstracting this very important relation.

FGj-xjrd
Автор

Very exhaustive and eloquent.
I love these videos.
Ps. I used to find sql boring.

himanshutripathi
Автор

Could you compare the performances among the three approaches?

ennioVisco
Автор

This is exactly how I would handle this. Great video 👍🏾

limitlesskode
Автор

ORMs get a lot of hate in some circles, but you seem to be a strong advocate for it. Could you make a video about why you should use an ORM?

Pekzr
Автор

One interesting approach to getting the data in an array is using json functionality, ive only ever seen it in drizzle and using postgres, i went through the generated query and its pretty performant plus the database is probably faster at json stuff than my js application

isaacfink
Автор

Your videos are consistently amazing Aaron!

GringoDotDev
Автор

Learned like 7 new things in 15 minutes

DaviMartins
Автор

We call them junction tables. Good video!

GerryDanen