Database Interview Questions and Answers
<< Previous Question Next Question >>
 Question: 4195 Page Views: 

How do you implement one-to-one, one-to-many and many-to-many relationships while designing tables?



Posted By: Avi Date: 7 October 2009 02:51:09 AM
 Answer:

One-to-One relationship can be implemented as a single table and rarely as two tables with primary and foreign key relationships.

One-to-Many relationships are implemented by splitting the data into two tables with primary key and foreign key relationships.

Many-to-Many relationships are implemented using a junction table with the keys from both the tables forming the composite primary key of the junction table.


Posted By: eTechPlanet


Date: 7 October 2009 02:51:09 AM
Post a better Answer if you have
 
(Will show your Gravatar icon)  
  Country flag

Loading
Enter the text as shown in the image gWhiPR
Related Questions
Database : What do you mean by concurrency?

What do you mean by concurrency?

Concurrency refers when the two or more transaction are executed simultaneously.
Category: Database Date: 8/20/2009 3:03:52 AM
Database : What is a Candidate key?

What is a Candidate key?

Candidate key is a set of one or more attribute other than primary key that can uniquely identify a ....
Category: Database Date: 8/20/2009 3:02:40 AM
Database : What is a Foreign Key?

What is a Foreign Key?

A foreign key is a referential constraint between two tables. The foreign key identifies a column or....
Category: Database Date: 8/20/2009 3:01:26 AM
Database : What is a Primary Key?

What is a Primary Key?

Primary key is the unique identifier for a record in the table. Here record refers to the value in t....
Category: Database Date: 8/20/2009 2:57:19 AM
Database : What is a DBMS?

What is a DBMS?

DBMS is a system where all interrelated data is atored and it allows the user to access data, modify....
Category: Database Date: 8/20/2009 2:56:07 AM