Database Design 41 - Introduction to Joins — Transcript
Full transcript
- 0:00hey you slacker you skipping class now
- 0:06you need someone to help you through the
- 0:07join process and you're all confused
- 0:10well luckily for you I'm here to help
- 0:13you so this video we'll be talking about
- 0:15joins and in fact the next whole group
- 0:18of videos will be about joins so it's
- 0:21going to be a lot now joins are a
- 0:24complex subject they're they could be
- 0:26confusing and tricky and uh very
- 0:30syntactical I don't even know if that's
- 0:31a word but basically the syntax from
- 0:34relational database management to
- 0:36another relational database management
- 0:38system can be confusing and complex but
- 0:43rather than diving in just learning all
- 0:46that stuff we're going to be talking
- 0:47about the concepts of what the types of
- 0:51joins are and I know you might not even
- 0:53know what a join is yet so you're
- 0:54probably thinking I don't know what
- 0:55you're talking about well that's what
- 0:57we're talking about today so thank you
- 0:59for joining me let's begin so a join is
- 1:04when you take something that's
- 1:06structured in a database in a confusing
- 1:08non- userfriendly way and you're
- 1:10presenting it in a userfriendly
- 1:13way now this is done so that way we can
- 1:17store our data in the database in a way
- 1:19that's the best structured to where we
- 1:22protect our data integrity and it's
- 1:24normalized and separated across tables
- 1:26with the proper relationships and data
- 1:29types and keys and indexes and
- 1:32everything but when we actually want to
- 1:35present that data for example on a web
- 1:37page or in a program or to the um
- 1:41analyzer person who goes and analyzes
- 1:44and does a calculations on our data or
- 1:47just views those calculations after the
- 1:49database does all the work with the
- 1:52analyzation well that end result is
- 1:55often in a way and it looks in a way
- 1:57that uh is organized and structured and
- 1:59makes sense to us that's the purpose of
- 2:02a join so it takes a mess and puts it
- 2:05out in a way that looks beautiful and
- 2:07this can be done over multiple tables so
- 2:10for example we could have a table
- 2:13here a table here and a table here and
- 2:16these could all be three different
- 2:18tables with relationships between the
- 2:20tables we won't get into any specifics
- 2:23of what kind of tables but basically a
- 2:25joint is going to take all of
- 2:27this and it's going to present us with
- 2:31a generated table that is more
- 2:35pretty it's more beautiful and more
- 2:38structured and it makes more sense now
- 2:41the way this is done is using foreign
- 2:43key primary key connections so when we
- 2:47have these relationships between these
- 2:49tables where I drew these arrows here
- 2:52that represents a a a foreign key
- 2:55connection that references a primary key
- 2:58so one of these t tables is the parent
- 3:00one of them is the child and we want the
- 3:03end result to combine them together into
- 3:07one now when you do this these columns
- 3:11that are connected are going to be
- 3:12indexed to make it much faster now uh
- 3:15when you join tables often you'll
- 3:18replace names of things with more
- 3:23userfriendly names so for example we
- 3:25could have you know let's say we had a
- 3:28comment on a website
- 3:30and it says
- 3:33wow
- 3:35lame and then this is posted by uh
- 3:40Caleb well you can see that if you have
- 3:43that username here it it might actually
- 3:46be a user ID in a comment table so for
- 3:49example we could say this up here is the
- 3:52comment table this is the user table and
- 3:55there's a foreign key from the user ID
- 3:58referencing the user ID ID in the user
- 4:00table well we when we present that data
- 4:03on a database we will want to replace
- 4:05that user ID with the actual username so
- 4:09rather than having you know we could
- 4:11have it to where it's like user ID of a
- 4:164,582 and then you're like oh I don't
- 4:19really know what that means well since
- 4:22this is all within the comments table
- 4:23now we're going to take information from
- 4:25the user table and put that username
- 4:28instead of the user
- 4:35ID that is how a join works
- 4:39conceptually that's another important
- 4:41thing all this think of it conceptually
- 4:44these videos are going to be helping you
- 4:45understand the concepts of the different
- 4:47kinds of joins and throughout it I'll be
- 4:49giving you some examples of how you
- 4:51would type that in SQL maybe but I'm not
- 4:54going to be getting into the specifics
- 4:57that's because joints are done
- 4:59differently from database management
- 5:01system to database management system so
- 5:04what you just need to know is how the
- 5:06joins work and the expected
- 5:11results and then when you start working
- 5:13with mySQL or SQL server or Oracle
- 5:16database or whatever else then you can
- 5:19just uh figure out how to do their joins
- 5:22you'll already know what the results are
- 5:24going to be because you understand the
- 5:25joins and then you just type it out boom
- 5:28you got a join there
- 5:30now this is one other thing to know
- 5:32that's important is all of this is uh
- 5:35data manipulation most of what we've
- 5:37been talking about before is data
- 5:39definition so that was in um basically
- 5:42ddl but now we're going on to
- 5:47DML so ddl data definition language and
- 5:52data manipulation language these are two
- 5:57parts of SQL we all we all talked about
- 6:00this in uh the older videos but we're on
- 6:03like way farther now so you guys might
- 6:05have forgot this but this is important
- 6:07to know because now we already have the
- 6:10definition the structure of the database
- 6:14the database might already be completely
- 6:15designed and structured with the columns
- 6:17and the rows but now we're manipulating
- 6:21that data to look a certain way so by
- 6:24doing joints you're not actually
- 6:27changing the structure of the database
- 6:30you are changing the presentation of
- 6:34that database that is extremely
- 6:36important to know now you may be
- 6:39wondering why exactly do I need to know
- 6:42this because if I'm database designer or
- 6:46whatever really all I need to do is
- 6:49design the structure of the database and
- 6:50then the database administrator or the
- 6:53software engineer person or whoever can
- 6:56go in there and use my database that I
- 6:59designed and created and they can do all
- 7:01the data manipulation stuff to fit their
- 7:03application right well maybe but not
- 7:07likely that's because the joins are also
- 7:11very important to understand because
- 7:14when you design your
- 7:15database you need to think of it in a
- 7:19userfriendly
- 7:20way and then normalize it make it
- 7:24confusing and then present it in a
- 7:26userfriendly way it's kind of confusing
- 7:29because
- 7:29you start with let's say you really bad
- 7:32at database design and you're
- 7:34structuring a table and you have it to
- 7:36where it's like comments a comment
- 7:40table and within this you have a
- 7:43user
- 7:45name and then you have the the
- 7:49comment and then maybe the blog post or
- 7:52video whatever it doesn't really matter
- 7:53you can have some IDs in there basically
- 7:56you don't know what you're doing and you
- 7:58put the username
- 8:00we'll just go with Caleb C comment lame
- 8:04I got another one from Caleb C
- 8:07cool Caleb
- 8:09C
- 8:13awesome when you look at this and you
- 8:16show it to your grandma she understands
- 8:18it she's like okay she might not
- 8:22understand it but she gets if you
- 8:23explained it she might Caleb C posted
- 8:26the comment lame Caleb C also posted the
- 8:29comment cool Caleb also posted the
- 8:31comment oops Caleb C also posted the
- 8:33comment
- 8:34awesome but this isn't the best way to
- 8:37do this because we learned about data
- 8:38integrity and also repeating data
- 8:41because now we have this in here three
- 8:43times so instead we use a user ID we get
- 8:47rid of Caleb C and we get rid of the
- 8:50username we have a user
- 8:53ID and then in here we have the user
- 8:57id6 ah let's not use that number number
- 9:007 77 and then over here we have a user
- 9:05table with the a user
- 9:09ID column which has all of our user IDs
- 9:13for each individual person so we started
- 9:16off with
- 9:18this friendly design but in reality it
- 9:21doesn't work because it's not normalized
- 9:23there's repeating data but it looks
- 9:25pretty once we have that then we can
- 9:27break it up and normalize it so that way
- 9:31we have multiple tables so we have this
- 9:33table and then we have this table over
- 9:36here but that's not the only thing we do
- 9:39the next thing we have to do is we have
- 9:41to take up those pieces of the puzzle
- 9:44and put them back together in a join to
- 9:47get the final result so we basically
- 9:50want to replicate the original table we
- 9:52had here by using a join of our
- 9:55normalized database and recreating it so
- 9:59what we're going to do is we're going to
- 10:01take the user ID column and we're going
- 10:03to take uh the user
- 10:06ID can you guys see that all all good
- 10:09it's over there this this will likely
- 10:11also have a username column so I kind of
- 10:14ran out of room here but
- 10:17username and that usern name user ID is
- 10:20seven will be connected to Caleb
- 10:22C using a
- 10:24join we are going to connect these two
- 10:27tables by basically
- 10:29using this foreign key which points to
- 10:31the
- 10:32seven and finding the associated
- 10:35username with that user ID and our join
- 10:38will look like
- 10:40this
- 10:43username
- 10:45comment and the the name of the table
- 10:48can be I mean whatever you want it could
- 10:49be generated table or it doesn't even
- 10:52need a name if you're just putting it on
- 10:54a website or something and then under
- 10:56the username column it'll be a
- 10:59Caleb
- 11:01C and then Caleb
- 11:03C and then Caleb
- 11:06C and then under the comment you're
- 11:08going to have
- 11:10lame and uh
- 11:12cool and
- 11:15awesome but this wasn't just like this
- 11:18to begin with we got the username from
- 11:21this table and we got the comment from
- 11:24this
- 11:25table so not only do you have to design
- 11:29the structure of the database but you
- 11:30have to structure the joins to basically
- 11:34put our database back into simple
- 11:38language or Grandma readable tables okay
- 11:43that that's basically what we want to do
- 11:45so let's say you get a job or you're
- 11:47working for a developer or something and
- 11:49they say okay on my website I want a
- 11:52table on this uh users page where I can
- 11:56sign in with my username password and I
- 11:59can see their username their password
- 12:02their email their uh date they signed up
- 12:06and everything like that and if I want I
- 12:08can go in there and edit it that way
- 12:10they don't have to go in and type SQL
- 12:12you're you're going to have that
- 12:14programmed in the
- 12:16um in the uh actual application to send
- 12:21that SQL but we need to structure the
- 12:23tables we need to make a join that's
- 12:25going to be able to combine those all to
- 12:27one pretty table which that's the job of
- 12:30the database designer likely I mean if
- 12:33the application or the database is huge
- 12:36you might have someone who does the the
- 12:38um designing and then someone who does
- 12:41the implementation and then someone who
- 12:44does the joints and then someone who
- 12:45does this other junk but I mean if
- 12:48you're just working on your own and you
- 12:50got to do everything you're also going
- 12:51to have to design the joints and I
- 12:53highly highly highly recommend you do
- 12:55that before you go in and programming
- 12:58your app application and then you're
- 12:59like oh crap I don't know how to do this
- 13:01or oh my database is structured wrong
- 13:04you want to do this all beforehand don't
- 13:06rush into things because then you're
- 13:08going to be like dude dog my application
- 13:11ain't working right and the reason is
- 13:13because you didn't take the time to
- 13:14structure your database the right way
- 13:16and develop your
- 13:18joints man okay once you got that you're
- 13:22good to go and yeah so there are a
- 13:25couple different kinds of joins there's
- 13:27inner joins outer joints joins cross
- 13:29joins unions there's all kinds of
- 13:32different things that we're going to be
- 13:34talking about and we're just going to be
- 13:36scratching the surface of each and every
- 13:38one so after these uh next group of
- 13:41videos you will be sufficient in Joins
- 13:44you can be like
- 13:46joining good so yeah catch you in the
- 13:49next video and stay in school or or
- 13:53watch my videos one of the two peace out
About this transcript
This page contains the full transcript of Database Design 41 - Introduction to Joins by Caleb Curry, generated from the public captions YouTube serves with the video. The transcript has 2,127 words across 311 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.