0:02 [Music] 0:12 hello friends welcome back to our 0:13 channel so in today's session we will 0:15 discuss about one more concept in dbms 0:18 that is a relationships 0:26 so first we will see what is this 0:28 relationships and why we required in the 0:30 dbms and then we will see the categories 0:33 of these relationships that means how 0:34 many uh types of relationships are there 0:37 right so first 0:39 why we require these relationships 0:41 so coming to the relational database 0:44 management system here the data will be 0:46 represented in terms of rows and columns 0:49 and we call them as a tables 0:52 tables so there will be a multiple 0:54 tables for a data so there will there 0:57 will be a table 1 0:58 there will be a table 2 1:01 there will be a table 3 1:04 etc right so the complete data will be 1:07 divided into at different tables now 1:10 after that we have to relate these two 1:12 tables these different tables right so 1:15 we have to relate 1:17 relate these tables right from one 1:19 record to another record so that 1:22 will be called as a 1:24 relationship 1:26 relationship so by using this 1:29 relationship one table data will be 1:32 related to the data available in the 1:34 another table and further for this 1:36 purpose we are going to use the two 1:38 different keys like 1:40 primary key 1:42 primary key 1:46 foreign key 1:47 so by using these two keys will relate 1:50 different tables so 1:52 what about i mean what exactly this 1:54 primary key what is meant by this 1:56 foreign key we'll see in the next 1:57 session so we'll see the different types 1:59 of keys in the next session so by using 2:01 these keys we will relate the different 2:04 tables 2:05 right so that we call it as a 2:07 relationship 2:08 relationship now we will see what are 2:11 the different types of relationships 2:13 available 2:14 in our dbms 2:18 the first one 2:22 one to one relationship 2:27 one too many relationship 2:34 many too many relationships 2:36 so there are three types of 2:38 relationships one to one 2:40 one too many sorry one too many and 2:43 one two sorry many too many so these are 2:45 the different types of relationships 2:47 so 2:48 let us take this one to one relationship 2:51 one to one relationship 2:53 so here we are having two different 2:55 tables 2:58 okay so first of all see 3:02 let us consider 3:06 table 1 3:11 and this one is a 3:15 table 2. so these are all the 3:18 records in the table in the table one 3:21 and in the table two 3:23 now 3:25 if 3:26 one record 3:28 one record here record means it tuple or 3:31 we can also call it as an entity right 3:34 or a row 3:36 so one record 3:38 of table one 3:40 of table one 3:42 is 3:43 related to 3:45 is related to 3:47 only one record 3:51 one record 3:52 of table two 3:56 table two 3:57 and 4:00 vice versa 4:02 vice versa that means if you consider 4:04 one record of table two that should be 4:06 related to only one record of table one 4:09 so such type of relationship we call it 4:12 as a 4:12 one to one relationship 4:15 one to one so if you consider one record 4:17 in table one that should be related to 4:20 exactly one record in the table two for 4:23 example consider 4:26 a 4:26 person a person details in table one 4:30 and in table two 4:32 let it be some passport details passport 4:34 details you can see one person will be 4:37 ha is related to only one passport 4:39 number so one for one person will be 4:41 having only one passport number right 4:44 similarly one passport will be given to 4:47 only one person so one password will be 4:49 given to not more than one right so 4:53 this type of relationship this type of 4:55 relationship we call it as a one-to-one 4:58 so a person so one person is associated 5:01 with only one passport 5:03 similarly one passport is given to only 5:07 one person so one passport will not be 5:09 given to multiple persons and one person 5:12 will not get a multiple passports so 5:14 such type of relationship we call it as 5:16 a one to one so one record in table one 5:19 is related to exactly one recording 5:22 table two similarly one recording table 5:24 two exactly related to 5:26 one recording table one this is called a 5:29 one two one relationship the next one 5:37 one too 5:38 many 5:40 one too many so in this one too many the 5:43 name itself indicates one record of 5:45 table one 5:46 one record of table one should relate to 5:49 multiple records of table two okay one 5:52 record of table one 5:54 should be related to multiple records of 5:57 table two similarly 5:59 one record of table two should exactly 6:01 match with only one 6:03 record of table one 6:05 right see don't get confused 6:09 one 6:10 record record or row or a tuple or 6:13 entity whatever it may be one record 6:15 of 6:16 table 1. 6:20 is 6:22 related to 6:27 multiple 6:30 records 6:31 of 6:35 table two that's the first point so one 6:37 record of table one is related to 6:40 multiple records of table two 6:42 and 6:46 one record 6:49 of 6:51 table two 6:55 is related to 6:58 only 6:59 one 7:02 record 7:03 of 7:04 table one that means the vice versa is 7:06 not possible the vice versa is not 7:08 possible see consider 7:16 are two tables here 7:25 there are two tables 7:44 they will do 7:45 so if this table one consists of 7:48 branch 7:49 okay bank consider the banking okay 7:52 banking sector 7:53 banking sector 7:55 so one branch 7:59 one branch 8:02 multiple accounts 8:06 multiple accounts so different 8:08 users why different users will be having 8:11 different accounts 8:12 so there will be different types of 8:14 accounts savings account current account 8:15 what etc etc joint accounts so 8:18 one branch manages 8:21 multiple accounts 8:24 one branch 8:26 manages multiple account that means one 8:29 record of table one is related to 8:32 multiple records of table two 8:35 okay one record of table one is related 8:38 to multiple records of table two 8:41 the vice versa is 8:43 not possible so 8:44 multiple accounts multiple accounts 8:47 will be 8:48 managed by a single branch 8:51 so 8:52 one record of table two should be 8:55 associated with only one record of table 8:58 one 8:59 so that's what we have written here so 9:00 one record of table one that means a 9:02 branch 9:03 is related to multiple records of table 9:05 two so one branch is managing different 9:08 accounts multiple accounts multiple 9:10 users 9:11 okay similarly one record of table two 9:13 that means one account of table two 9:16 is related to only one record of table 9:18 one so that will be managed by a single 9:20 branch it will not be managed by 9:22 multiple branches 9:24 right so this type of relationship we 9:26 call it as in one too 9:28 many 9:29 one two main so one record of table one 9:32 related to multiple records of table two 9:35 and one record of table two should be 9:37 related to only one record of table one 9:40 so the third category 9:42 many too many 9:43 so let us see 9:47 here the name itself indicates many too 9:49 many 9:54 see 10:02 many too many relationship many too many 10:04 means 10:07 one record of table one is related to 10:10 multiple records of table two and one 10:12 record of table two is related to 10:14 multiple records of table one 10:17 okay see 10:20 one record 10:22 one record 10:23 of table 1 10:26 of table 1 10:28 is related to 10:32 multiple records 10:38 of table two 10:41 and vice versa is also possible 10:44 so 10:45 one record 10:48 of table two 10:53 is related to 10:58 multiple records 11:01 multiple records 11:03 of 11:05 table one 11:06 right so this this type of relationship 11:09 we call it as a many-to-many 11:11 example 11:13 consider a table 11:17 consider a table 11:21 so s1 11:23 s2 11:24 s3 11:26 s4 11:27 so this is a table 11:30 one 11:32 and coming to the second table 11:34 right on the second table 11:40 c one c2 c3 c4 11:44 this is a 11:46 table 2 so this is a student table 11:52 this is a course table 11:54 course table so here you can observe 11:58 so student can enroll multiple courses 12:02 student can enroll multiple courses 12:06 similarly one course 12:08 can be uh 12:10 [Music] 12:11 i mean enrolled by multiple students 12:14 one co one course can be enrolled by 12:16 multiple students right see s1 and roles 12:20 c1 c2 c3 c4 12:24 similarly s2 12:26 and roll c1 c2 12:28 c3 c4 12:30 s3 c1 c2 c3 c4 12:34 s4 c1 c2 c3 12:38 c4 12:40 right so student 1 can enroll all the 4 12:43 courses similarly student 2 can enroll 12:45 all the 4 courses so c1 is enrolled by 12:49 the students s1 and s2 12:52 okay so for example if the s1 enrolls 12:54 the screw core says c1 12:57 c2 c3 c4 12:59 s2 enrolls the core says c1 c3 c4 13:04 s3 enrolls this courses three c3 and c4 13:08 s4 enrolls the course c1 13:10 now you can observe 13:12 one record of one table s1 is a one 13:15 record of one table is related to 13:18 multiple records of another table that 13:20 means a course table so multiple records 13:23 c1 is one record c2 is another record c3 13:25 is another record and c4 another record 13:27 so s1 is related to multiple records 13:30 right similarly if you observe the vice 13:33 versa so c1 is related to 13:37 s1 13:39 s2 es4 13:41 c2 cores 2 is enrolled by s1 13:46 and c3 is enrolled by s1 13:49 s2 es3 13:52 c4 is enrolled by 13:54 s1 13:55 s2 13:56 s3 13:57 so you can observe the vice versa also 14:00 one record c one is one recording table 14:02 two one record is associated or related 14:05 with multiple records of table one s one 14:08 is one record s two is another s4 is 14:10 another 14:12 right so this type of relationship this 14:15 type of relationship we call it as a 14:17 many too many 14:19 this type of relationship we call it as 14:21 a mini to many relationship 14:25 okay so 14:26 one record of table one is related to 14:29 multiple records of table two similarly 14:32 one record of my table two related to 14:35 multiple records of table one 14:38 so these are the three categories of 14:41 relationships three types of 14:42 relationships one to one one to many and 14:45 many too many 14:47 right so hope you understood these 14:49 different types of relationships in dbms 14:51 so hope you understood and if you are 14:53 having any doubts regarding this one 14:54 feel free to post your doubts in the 14:56 comment section definitely i will try to 14:57 clarify all your doubts if you really 14:59 enjoyed my session like my session share 15:02 my session with your friends and don't 15:03 forget to subscribe to our channel 15:05 thanks for watching thank you very much