SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Cardinality
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Mohamed Faisal
Yak Posting Veteran

51 Posts

Posted - 09/24/2012 :  01:49:57  Show Profile  Reply with Quote
HI All,

I have created a few tables in a database. But how do I cardinality between the tables.For example like 1:N,M:M or 1:N,M:O.
is there a code for to declare them in the tables.

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 09/24/2012 :  03:05:44  Show Profile  Reply with Quote
nope...its done by means of bridge tables ie tables having reference fields from parent tables. you can mark nature of relationship using data modelling tools

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Mohamed Faisal
Yak Posting Veteran

51 Posts

Posted - 09/24/2012 :  03:43:51  Show Profile  Reply with Quote
Dear visakh16,

That means there is no coding needed for in the SQL. Then why do we do the cardinality for. Is it part of the designing the database process.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 09/24/2012 :  13:06:32  Show Profile  Reply with Quote
thats what I told. its a concept. the implementation is done by creating a bridge table having id fields from master table as foreign key references. The nature of relationship is specified in database model diagrams created using data modelling tools

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

klca
Starting Member

17 Posts

Posted - 06/16/2013 :  10:32:53  Show Profile  Reply with Quote
quote:
Originally posted by visakh16

thats what I told. its a concept. the implementation is done by creating a bridge table having id fields from master table as foreign key references. The nature of relationship is specified in database model diagrams created using data modelling tools

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





If there is no use more than showing it on a diagram, what is the big fuzz of it? It will be really good that such cardinality could be built as an integral part of your database structure (or schema) because it will give you a lot of validation and constraints that otherwise will require a lot of code in order to achieve such validation, doesn't it?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 06/17/2013 :  00:55:37  Show Profile  Reply with Quote
quote:
Originally posted by klca

quote:
Originally posted by visakh16

thats what I told. its a concept. the implementation is done by creating a bridge table having id fields from master table as foreign key references. The nature of relationship is specified in database model diagrams created using data modelling tools

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





If there is no use more than showing it on a diagram, what is the big fuzz of it? It will be really good that such cardinality could be built as an integral part of your database structure (or schema) because it will give you a lot of validation and constraints that otherwise will require a lot of code in order to achieve such validation, doesn't it?


The cardinality is implemented by means of primary key foreign key relationships in database.. For 1 - to - 1 and 1 - to - N it simply is represented using master child tables. For M- to - N its implemented by means of a bridge table which will just have reference ids of parent tables and will have multiples per each table

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000