Skip to content

nityatripathi019/DatabaseRelationships

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Database Relationships

Topics to be covered :

  • One to One Relationships
  • One to Many Relationships
  • Many to Many Relationships

One to One Relationships: In one to one relationship ..let there be two table that are connected to each other so in this case one table consist a primary key that comes out to be foreign key for another table...so here one to one connection is formed..

One to many : we take ex of ig post and quora post ..so here there is single user can create multiple posts

Many to Many : in this we take ex of student table and subject table so in this a single student can take multiple subj likewise a single sub can taken by multiple student so this is ex of many to many

One to Many / Approach 1 (one to few)

Store the child document inside parent In this we take ex of uber,ola ,swiggy,zomato ..yha pr hm user ka name rakhte h addresses rakhte h to isme ek user jyada se jyada 2,4 addresses hi store krata h

One to Many / Approach 2

Store a reference to the child document inside parent

populate in mongoose

//output terminal me to full object jayega mongoose me but hm mongodb db dekhenge to waha sirf items ki object id jayegi naki whole object

//populate in mongoose : isse hm jo database me object id data stored hota h uske through hm whole data ko fetch kr skte h

One to Many (Approach 3 One to squillions)

About

In this we gonna learn about various database relationship like one to one relationship one to many relationship , Many to Many relationship etc..

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors