If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > I need some basic explanation about constraints, ONE-TO-ONE, ONE-TO-MANY etc

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-08-10, 11:14
siemprepeligroso siemprepeligroso is offline
Registered User
 
Join Date: Apr 2010
Posts: 7
Lightbulb I need some basic explanation about constraints, ONE-TO-ONE, ONE-TO-MANY etc

I am having difficulties in understanding this constraints between entity sets (tables)

ONE-TO-MANY
ONE-TO-ONE
MANY-TO-MANY

if someone could explain me the logic behind this concepts I would be grateful.

thanks
Reply With Quote
  #2 (permalink)  
Old 06-08-10, 13:24
loquin loquin is offline
Super Moderator
 
Join Date: Jun 2004
Location: Arizona, USA
Posts: 1,797
Here's a useful tutorial pertaining to referential integrity.
__________________
Lou
使大吃一惊
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert

Reply With Quote
  #3 (permalink)  
Old 06-08-10, 15:02
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
I don't think that link quite answers your questions.

ONE-TO-MANY Typical relationship between a parent and child table. For instance,
you will have an order table, which contains your customer, date the order was placed and some other items. Then you would have an order_detail table, which would contain an entry for each item that is on the order, like item being purchased, how many units, etc...
ONE-TO-ONE I kinda do not like these and would prefer that they just be folded into a single table. Say something like you have an order table and an order date table. The reason I do not like them is due to the redundancy of the primary key and the index, plus the additional complexity of maintaining the table. I have yet to see a good reason given to me to have a ONE to ONE relationship.
MANY-TO-MANY Most times, something is wrong with your model and you have left something out in the middle of two tables that would properly join them together with a ONE to MANY relationship on both sides. See http://en.wikipedia.org/wiki/Many-to-many_(data_model)
Dave
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On