| |
|
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.
|
 |

03-19-08, 03:39
|
|
Registered User
|
|
Join Date: Mar 2008
Posts: 11
|
|
|
Theory Question
|
|
Hi there,
I have a question regarding the difference between structurally enforcing a functional dependency versus procedurally enforcing a functional dependency.
Not being able to find any actual definitions for these, my educated guess is that a functional dependency is enforced: - structurally when it is enforced using one of the constraints available in the relational model e.g. primary key, foreign key, check constraint, uniqueness constraints etc.
- procedurally when it is enforced using some means outside the relational model e.g. a stored procedure, a trigger or some other kind of coding.
If anyone can set me straight or confirm my thoughts I would be much obliged. Note, this forum is not my first port of call. I have attempted to find this answer in many books and using Google.
Thanks
|
|

03-19-08, 06:13
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
Your definitions appear perfectly sound to me 
|
|

03-19-08, 08:42
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
|
|
|
|
i though FD was all about the relationship between non-key attributes and keys
you know, normalization
|
|

03-19-08, 09:32
|
|
World Class Flame Warrior
|
|
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
|
|
OK.
So next question for discussion would be "When would procedural integrity be preferential to structural integrity?"
__________________
If it's not practically useful, then it's practically useless.
blindman
www.chess.com: "sqlblindman"
|
|

03-19-08, 09:58
|
|
King of Understatement
|
|
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
|
|
I prefer the term declarative integrity.
And yeah - can the OP supply an example of a functional dependency that cannot be enforced declaratively? Or have missened the point again....
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
|
|
|

03-19-08, 10:04
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
|
|
Quote:
|
Originally Posted by pootle flump
Or have missened the point again....
|
no, haven't missened
|
|

03-19-08, 20:49
|
|
Registered User
|
|
Join Date: Mar 2008
Posts: 11
|
|
Hi everybody,
Thanks very much for your replies. Later today, I will post the exact scenario that I am talking about. I have to be at a meeting now and don't have the time to make that post.
So ... until a bit later.
Thanks again.
|
|

03-20-08, 06:02
|
|
Registered User
|
|
Join Date: Mar 2008
Posts: 11
|
|
Hi Again. Here is the whole scenario.
We start with a table in 3NF {Degree, Faculty, Coordinator}
The functional dependencies extant in the data are:
Degree, Faculty -> Coordinator AND Coordinator -> Faculty
From that, we can discern the candidate keys (using Armstrong's axioms) -:
Degree, Faculty AND Degree, Coordinator
So, we can now decompose that to BCNF:
DegFac_tbl: {Degree, Faculty}
Coord_tbl: {Coordinator, Faculty}
We lose 1 FD in that decomposition (as is common when decomposing to BCNF) - Degree, Faculty -> Coordinator
Now we get to the question which I was unsure of and originally asked.
One of the FDs can be enforced structurally i.e. Coordinator -> Faculty (co-ordinator being the PK of the relation Coord_tbl.
Therefore, we must use some other means to enforce the lost FD e.g. a stored procedure, trigger or the like. I used the term procedurally to describe this.
I hope I haven't bored everyone. It's really just a definition thing. I have the concepts down pat perfectly. I just want to make sure that I am using the correct lingo when discussing it.
Thanks
|
|

03-20-08, 07:31
|
|
vaguely human
|
|
Join Date: Jun 2007
Location: London
Posts: 2,519
|
|
Quote:
- structurally when it is enforced using one of the constraints available in the relational model e.g. primary key, foreign key, check constraint, uniqueness constraints etc.
- procedurally when it is enforced using some means outside the relational model e.g. a stored procedure, a trigger or some other kind of coding.
|
Procedural RI implies that something (a proc) needs to be called explicitly to enforce the RI. Structural implies that the RI is built into the database and so cannot be sidestepped ie FKs. If the above is true then surely triggers are structural and not procedural as mention above. Also at my current place we use Sybase with a database design tool to declare the FKs - this turns these FKs into triggers - what side of the fence would these FKs sit on?
|
|

03-20-08, 08:01
|
|
King of Understatement
|
|
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
|
|
Although it acts like DRI in the way describe I would put triggers as procedural. In effect the are like event prodecures in other languages - they are procedures that are triggered by events. How closely coupled they are with the database tables is not really the defining characteristic IMO.
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
|
|
|

03-20-08, 09:33
|
|
Registered User
|
|
Join Date: Mar 2008
Posts: 11
|
|
That is an interesting point. Some databases (like ProstgreSQL) use triggers to enforce the foreign keys. However, in a situation like this, I believe the trigger usually calls a procedure. I know in PostgreSQL that triggers call trigger procedures. So in effect, although it is triggered automatically, it does call a procedure (depending on the situation).
But importantly, your statement that Procedural RI implies that something (a proc) needs to be called explicitly to enforce the RI has helped a lot. That really makes sense to me. And in the context of my example, it does make sense.
Out of the two FDs, you could definitely say that the FD Coordinator -> Faculty can be enforced structurally (with my new understanding of that term).
As for the other FD (Degree, Faculty -> Coordinator), it would be implementation-specific, and therefore, not clear-cut. Perhaps procedurally, perhaps structurally.
Thanks for helping me think through these concepts/definitions. It's been a great help.
|
|

03-20-08, 09:40
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
|
|
stop beating yourself up over all that nonsense and go back to the 3NF design
it's one more FD and one less table, dude
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|