Database Design 18 - Designing Many-to-Many Relationships

Поділитися
Вставка
  • Опубліковано 9 лют 2025

КОМЕНТАРІ • 120

  • @Professor__Cow
    @Professor__Cow 9 місяців тому +2

    come for the informative database design info, stay for the wholesome cringiness. This series is great! Thank you!

  • @VTS-lelovsky.
    @VTS-lelovsky. 9 місяців тому +4

    Almost 10 years later - you are an amazing teacher. I've started with the first video and you've explained so many concepts in such a clear way. Thank you!

    • @Professor__Cow
      @Professor__Cow 9 місяців тому +1

      Same here. I'm at Western Governors University, majoring in Cybersecurity, taking Data Management - Foundations - D426. This video series is awesome.

  • @stuartrobinson9647
    @stuartrobinson9647 9 років тому +27

    Those lines you drew at 12:46 were fucking crisp.

  • @thuvarakan6974
    @thuvarakan6974 5 років тому +4

    I cannot thank you enough .. After 5 years still useful content ..

  • @JoeBigSh0w
    @JoeBigSh0w 8 років тому +56

    Totally helped me grasping the concept of intermediary tables and what they're for. The only question left for me to ask is: Who's Claire?

    • @lasloven4279
      @lasloven4279 6 років тому +8

      feel like Claire his ex, and he wrote down 666 just because he hates her so much

    • @muhammadyusoffjamaluddin
      @muhammadyusoffjamaluddin 5 років тому +3

      @@lasloven4279 Owh I can C there Clairely.

  • @trendsetter37
    @trendsetter37 9 років тому +18

    Serious SQL swag going on in this video!

  • @Jerriehomie
    @Jerriehomie 7 років тому +3

    Finally I am not sleeping during learning. Thank you.

  • @philmoore96
    @philmoore96 6 років тому +3

    Why I Came: my professor told us to so my class could understand this concept.
    Why I Stayed: Caleb is adorable and dorky.

  • @codebreakthrough
    @codebreakthrough  10 років тому

    Learn about Designing Many-to-Many Relationships by watching this new video! Please watch my other videos, "like" and subscribe!
    buff.ly/1o64SAU

  • @middbot
    @middbot 6 років тому +1

    Thank you so much for this!! I'm a front end developer who just got a back end based code challenge and this was a wonderful jumping off point.

  • @josefinamagallanes8451
    @josefinamagallanes8451 4 роки тому

    Thank you for the video- I subscribed over one year ago- and my professor added you as a example in our class- thank you so much for the video- thank you for being smart!

  • @bojanmikanovic7274
    @bojanmikanovic7274 12 днів тому

    10 years later. You are the best.

  • @iworshipjesus1597
    @iworshipjesus1597 7 років тому +10

    By His stripes we were healed indeed. Amen.

  • @sasadal066
    @sasadal066 7 років тому +3

    You sir, deserve a special place in heaven! THANK YOU!

  • @devasishkumarbadaik4697
    @devasishkumarbadaik4697 2 роки тому

    You’re genius in teaching. Literally i learned a lot from you.

  • @regulator5
    @regulator5 Рік тому

    Here is 2024! Thanks for making this. Its better content than my text book.

  • @j0hnnycache
    @j0hnnycache 7 років тому

    I still can't believe how much more I'm learning here compared to my instructor in my db design course.
    Thank.
    You.
    Good.
    Sir.

  • @BahramGhebray
    @BahramGhebray 10 років тому +8

    Thank you for the series. Really good explanation. God bless you

  • @ranjanadissanayaka5390
    @ranjanadissanayaka5390 4 місяці тому +1

    this was a very confusing topic for me. But thanks to you it's not confusing any more.

  • @oussamasallak9490
    @oussamasallak9490 Рік тому

    thank you so much for the effort, still useful after 8 years

  • @shanahjrsuping7344
    @shanahjrsuping7344 5 років тому

    This was very helpful. My question was actually, in the case of me making a database that stores different shows that i have watched, I wanted to know how I can give each show in the database multiple genres without having null values in some of the columns, the intermediary table solves that perfectly. thank you Caleb

  • @assahmalios4486
    @assahmalios4486 5 місяців тому

    Bro thanks for the tutorials. Really helped on my basic database design. Thank u very much from Papua New Guinea 🇵🇬

  • @muhammadyusoffjamaluddin
    @muhammadyusoffjamaluddin 5 років тому

    Guys I need to confess right here right now.
    I love to read Comments Section, especially this vid in this series.
    Thanks past Caleb Curry, may the force with you.

  • @emberafterglow4916
    @emberafterglow4916 4 роки тому

    I am exactly like you. You are exactly like me. Your way of speaking and goofy funny ways. I really identify with you. I am left handed and my hand writing looks exactly like yours. I think it is so cool that you made this video so long ago and you are so young. (I feel old now) Great Job on this entire series!!!!!! You are some one I look up to for the way you just get up there and speak off the cuff and from your actual knowledge. You Rock!!

  • @TayambaMwanza
    @TayambaMwanza 5 років тому

    I was doing ER diagrams, after watching this it clicked fully. I think what did it for me was the real life example.

  • @dgetzin
    @dgetzin 6 років тому

    It's funny because classes are _classes_ so students are objects. You're OBJECTIFYING students!

  • @UhelUhel
    @UhelUhel 7 років тому

    Bruv, this is best tutorial mix i've seen. U got my sub and large respect.
    Hope it will save my exams!

    • @codebreakthrough
      @codebreakthrough  7 років тому +2

      Thanks so much! Good luck!

    • @edisionadle1409
      @edisionadle1409 7 років тому

      IKR his explanation was amazing. The best explanation I have heard of for one to many relationships. It was so good I too subscribed.

  • @jakegti3
    @jakegti3 10 років тому +1

    Aw dude, I was so close to figuring this out, thanks for drawing it so I could get a grip on it~ I was kinda losing my mind~

  • @GabrielTobing
    @GabrielTobing 3 роки тому +2

    Wow...
    You've changed so much in 6 years XD

  • @partspieces8165
    @partspieces8165 Рік тому

    Bro thank u so much TT. U are a game changer!! Goodness, this really helped me a lotttttt

  • @poonzpiano
    @poonzpiano 4 роки тому

    Thank you sooooooooo much! my professor never taught me how to handle this many to many. She just said nah having many to many in your ER D is not good ...

  • @junianohjj4602
    @junianohjj4602 7 років тому

    I like your choice of examples, it made it easy for me to understand the concepts. Thanks a mill

  • @prabeshkhati4398
    @prabeshkhati4398 4 роки тому

    thanks mate you are a life saver

  • @wayandanyaeleco4969
    @wayandanyaeleco4969 5 років тому

    Thank you Caleb.

  • @drfizzisian874
    @drfizzisian874 11 місяців тому

    my university is using these 9 years after you made them

  • @confounded_feline
    @confounded_feline 10 років тому +1

    Hey Caleb your videos are a god send man thanks!! Got a question or two though. What would you suggest for naming conventions for intermediary tables? My other question is - If for example you had additional many to many relationships, do you just build as many intermediary tables as necessary? In this case you had a class with many students. What if you had a class with other multiplicities such as teachers and assistants for instance? Would we have 3 intermediary tables for each of these cases?

    • @codebreakthrough
      @codebreakthrough  10 років тому +5

      kaschax a combination of the two table names. so table user, table comment, and table user_comment. That makes it very clear that it is an intermediary table.
      Your other question is more complicated. we would have a class_student table, a class_instructor table, and a class_assistant table. The reason they are not connected in one table is because it is not structurally a ternary relationship or a higher n-ary relationship. (which I haven't even discussed in this course yet).
      In a ternary relationship the connection between 3 entities is required in one table for things to make sense.
      let's look at your question with some example data:
      student_id teacher_id class_id
      1 1 1
      2 1 1
      4 1 1
      10 1 1
      The way that is set up is with 1 intermediary table for both the student-teacher relationship, the teacher-class relationship, and the class-student relationship. The way we have it set up WOULD work but there would end up being a lot of repeating unnecessary foreign key references (some classes could have hundreds of students and for every row the teacher_id stays the same because the class_id stayed the same).
      it might make more sense to do this:
      student_id class_id
      1 1
      2 1
      4 1
      10 1
      teacher_id class_id
      1 1
      This solves the problem because the teacher_id depends upon the class but not the student. We took it and put it in a many-to-many relationship with just the class. For a given example of a student taking a class, we do not need the instructor_id in that row because we know who instructs the class because of the class_instructor table....
      Yeah...I'll probably just make a video explaining it. haha. Thanks!

  • @zoel639
    @zoel639 4 роки тому

    I LOVE your videos! So helpful and love the humour too!

  • @minhtao9774
    @minhtao9774 7 років тому +2

    ZZZZZZZZZZOMG YAAAAAAAAS! I finally understand this concept! Thank youuuuuuuuuu!

  • @josefinamagallanes8451
    @josefinamagallanes8451 4 роки тому

    Should I be watching in order?

  • @lorelynlunas2596
    @lorelynlunas2596 8 років тому +6

    Hi Caleb, Your videos are very helpful to me. Could you help me figure out what relationship is in the following set of entities:
    1. Students and Teachers
    2. Customers and Orders
    3. Employees and basic Salary Information
    4. Employees and Payroll Transactions
    5. Words and Meanings
    6. Countries and capitals
    7. Items and Item Locations
    8. Movies and Categories
    9. Medicine and Illness
    10. Patients and Doctors
    Hope you reply soon. Thank u Caleb. Gobless :)

    • @VivekGawande1
      @VivekGawande1 6 років тому +3

      1 m:n
      2 1:n
      3 1:1
      4 1:n
      5 m:n
      ....
      I'm not sure if you need the answer now. It's been 2 years

    • @deadman4222
      @deadman4222 6 років тому +1

      @@VivekGawande1 you can't just stop in the middle, at least finish it.

    • @VivekGawande1
      @VivekGawande1 6 років тому +2

      @@deadman4222 haha :D i was bored

    • @EricCartmanFTW
      @EricCartmanFTW 5 років тому +2

      6. 1:n (some countries have more than 1 capital, but one capital can only belong to 1 country)
      7. m:n
      8. 1:n (assuming 1 movie can only belong to one category, if you have comedy-horror, it'll be M:N)
      9. m:n
      10. m:n (1 patient can go to multiple doctors & doctors have multiple patients)
      The easiest way to solve this is to check if either side can ONLY have a single relation:
      For Example: 1:n (Husband-Wife) assumes that the husband can have multiple wives & assumes that wives can only have 1 husband. In order to give the best response proper documentation need to be written with all the assumptions & restrictions, hope this helps someone.

  • @wilbertraymundrayos4175
    @wilbertraymundrayos4175 4 роки тому +1

    Do you need to give primary key to the rows of junction table?

    • @codebreakthrough
      @codebreakthrough  4 роки тому

      You can have a surrogate id field or a compound primary key on two+ columns. I prefer the surrogate id

  • @kadenzxc
    @kadenzxc 10 років тому +11

    No, not Claire! Anyone but Claire!!

    • @kmc6165
      @kmc6165 8 років тому +1

      +Kaden Burgart LOL 666

    • @Giesela0815
      @Giesela0815 7 років тому +1

      Claire fucking ruined it again!

    • @jacobcasey28
      @jacobcasey28 5 років тому

      Did you forget about Karen?

  • @florenceokhajaguan2558
    @florenceokhajaguan2558 Рік тому

    Thanks for the video
    My question is will the intermediary table have a primary key and if it does what do you suggest it is for the example you used

  • @agrajyadav9
    @agrajyadav9 4 роки тому

    Great explanation, thank you.

  • @Lamouettekamikaze
    @Lamouettekamikaze 4 роки тому

    I think I get it.
    In a many to many situation a student can follow the same course twice or more.
    So we make a third table with the PK from the two table to prevent that ?

  • @tubun09
    @tubun09 6 років тому +1

    Parent vs Parent complication concept is very approachable. Thank you Caleb. btw, 2018 here?

  • @taylorrose9211
    @taylorrose9211 6 років тому +4

    Thank you!! (sorry about Claire)

  • @starvisor751
    @starvisor751 9 років тому

    Thanks a lot...you're a great instructor!

  • @sergionacinovic3181
    @sergionacinovic3181 6 років тому

    Clear and Simple,keep it up :)

  • @prriyka
    @prriyka 2 роки тому

    thank you!!

  • @ladedadedaschlobonmeknob7850
    @ladedadedaschlobonmeknob7850 8 років тому

    thanks man, I love you

  • @london-paris
    @london-paris 10 років тому

    Thank you Caleb for the wonderful explanation :-)

  • @oluadesina1575
    @oluadesina1575 6 років тому +1

    Very helpful

  • @josefinamagallanes8451
    @josefinamagallanes8451 4 роки тому

    Database design 18? So there’s 17 more videos 👀

  • @joshuadalley9212
    @joshuadalley9212 10 років тому

    Do you still recommend using a Surrogate Key inside the composite table or having two Foreign Key is enough?

    • @codebreakthrough
      @codebreakthrough  10 років тому

      I think the composite key is fine but some people prefer a surrogate key. The answer is there is no correct answer :P

  • @alippo84
    @alippo84 3 роки тому

    I'm working on Apex, so can I assume intermediary table as a view in Apex? so I can build 2 separated tables and connect then together by a view??

  • @Fractal80Y
    @Fractal80Y 7 років тому

    Thanks Nice Teaching! :)

  • @KatharsisderWelt
    @KatharsisderWelt 9 років тому +2

    there is a class called fashion?
    Nice video

  • @josefinamagallanes8451
    @josefinamagallanes8451 4 роки тому

    But if we get rid of John - then does all his information delete?

  • @colettepitamba8623
    @colettepitamba8623 9 років тому

    Dude...thank you!!!!

  • @kwesiaddo4872
    @kwesiaddo4872 6 років тому

    Hahahah 5:36 to 5:39 = Mind blown!

  • @spatialnasir
    @spatialnasir 4 роки тому

    Long but interesting video.

  • @abrorakhmedov7389
    @abrorakhmedov7389 2 роки тому

    does row in Intermediary table will have ID ?

  • @MrNaufan
    @MrNaufan 7 років тому

    I was about to search "Genesis - Many To Many" then this video appears

  • @dinakarmaurya8000
    @dinakarmaurya8000 7 років тому

    Good explanation

  • @yusefskaff2601
    @yusefskaff2601 8 років тому

    ur awesome !!

  • @afghanboy4022
    @afghanboy4022 9 років тому

    sometimes you make mistakes baby in during lesson keep training for being more efficient ;) a master advice ;)

  • @tzezc
    @tzezc 8 років тому

    thanks

  • @princeraheja6423
    @princeraheja6423 9 років тому

    great video

  • @wolfferoni
    @wolfferoni 7 років тому

    So basically what would've been an associative entity?

  • @patrickfeeney8569
    @patrickfeeney8569 8 років тому +1

    I thought it was funny when you said i hope you can clearly see and then he walks in front of the camera and it blurs.

  • @josefinamagallanes8451
    @josefinamagallanes8451 4 роки тому

    Everything gets id’s/👌🏽

  • @afghanboy4022
    @afghanboy4022 9 років тому

    heyyy and you are cleaning the board with your hand, that will hurt you ;) :P

  • @keshabaryal6233
    @keshabaryal6233 10 років тому

    what will happen if we delete any value from parents table to its child table ?

    • @codebreakthrough
      @codebreakthrough  10 років тому +2

      keshab aryal
      You can have it do a couple of different things. I recommend you watch my video about it:
      ua-cam.com/video/rOyZtFo4qaU/v-deo.html

  • @yltfy
    @yltfy 4 роки тому

    Why not Claire?

  • @branch1231
    @branch1231 7 років тому

    brother use white board and marker

  • @josefinamagallanes8451
    @josefinamagallanes8451 4 роки тому

    Foreign keys?

  • @GUDDAisHere
    @GUDDAisHere 10 років тому

    what about many employees to many sales???

  • @greatoutdoors6318
    @greatoutdoors6318 4 роки тому

    "Not Claire!" lol

  • @josefinamagallanes8451
    @josefinamagallanes8451 4 роки тому

    3 tables?

  • @PigeonscompanNk
    @PigeonscompanNk 8 років тому

    i am getting confusd in one to one and one to many realtionshps will someone help me out to clear it

    • @thoms1986
      @thoms1986 7 років тому

      Noroz Khan one to one means there is never the possibility that there is more than one answer to the question. So if we want to store credit card nr. It must be sure that there is only one answer possible. Then this info can go in the parent table and is one on one.
      If you have multiple answers possible. So for example comments. Then you cant store this in one row(draw it yourself). So we store this on a separate table where every comment can now have a row in the new table.

  • @renegade218
    @renegade218 8 років тому +5

    I know these videos are posted 2014 but i hope you will see my Comments, as i am the PARENT sending' AS YOU ARE THE CHILD receiving. HAhaha.. lol. Great! tutor thanks Bro!

  • @nelguzman6990
    @nelguzman6990 2 місяці тому

    so who' s claire? ;)

  • @monero.jeanniton
    @monero.jeanniton 7 років тому

    How old are you?

  • @josefinamagallanes8451
    @josefinamagallanes8451 4 роки тому

    Class students?

  • @r8bior
    @r8bior 7 років тому +1

    Bloody Claire...

  • @josefinamagallanes8451
    @josefinamagallanes8451 4 роки тому

    Classes/class students/students

  • @PigeonscompanNk
    @PigeonscompanNk 8 років тому

    like husband and wife relationship
    now which relationship is it one husband can have many wife and one wife can have one husband so which relationship is it

  • @Lamouettekamikaze
    @Lamouettekamikaze 4 роки тому

    I don't get it...why can't we just write many to many...M:M ? N for many is so dull 😄

  • @bydamaz3101
    @bydamaz3101 4 роки тому

    70 Claires clicked thumbdown lol

  • @josefinamagallanes8451
    @josefinamagallanes8451 4 роки тому

    Wait wait wait

  • @dengan699
    @dengan699 7 років тому

    I am not sure if you are 15 or 25 y.o, it's disturbing...

  • @limitless9483
    @limitless9483 4 роки тому

    this was before you hit puberty lol

  • @Niko-zl5hn
    @Niko-zl5hn 4 роки тому

    5:35 lmao

  • @fidangill8781
    @fidangill8781 7 років тому

    Can you use my name in the videos?. Fidan. :p

  • @josefinamagallanes8451
    @josefinamagallanes8451 4 роки тому

    👌🏽

  • @UhelUhel
    @UhelUhel 7 років тому

    1.25x doe

  • @josefinamagallanes8451
    @josefinamagallanes8451 4 роки тому

    😂