Thanks for the explanation, Joe... Can you expand your explanation to include the code that accomplish the constraint?
Thanks, Rick -----Original Message----- From: Joe Rinehart [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 30, 2005 12:06 AM To: CF-Talk Subject: Re: Database Model Suggestions - Elections Hey Rick, A "constraint" does just what it says - it enforces a rule. A "foreign-key constraint" refers to a type of constraint that, when placed on a column in one table, makes sure any values in that column reference a value in a column in a second ("foreign") table. Basically, if I had the following: User --------- UserId FavoriteColorId Color ---------- ColorId I could place a "foreign-key constraint" on User.FavoriteColorId that referred to Color.ColorId to make sure no values were ever entered into User.FavoriteColorId that weren't in Color. -Joe On Tue, 29 Mar 2005 23:48:45 -0500, Rick Faircloth <[EMAIL PROTECTED]> wrote: > > I am of course, assuming that you know the difference between a > > foreign-key constraint (which ensures data integrity by producing an > > error if an insert/update/delete statement would create a conflicting > > state in the data - in other words it doesn't allow the database to > > ignore errors in your code), and simply having two tables which are > > joined in your ad-hoc queries. > > Sorry, that's what I'm saying I don't understand. I realize you probably > don't want to go too much into the detail I'd need to full understand, but > if you have a good reference online for that I'd study it for clarification. > I've never used foreign-key constraints...sounds like something I should > learn and implement in my coding... > > It sounds like something I do when I don't allow the deletion of a > Real Estate agent when they still have properties in the database > assigned to them, which would ...anything to do with something like that? > > Rick > > > -----Original Message----- > From: S.Isaac Dealey [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 29, 2005 10:49 PM > To: CF-Talk > Subject: RE: Database Model Suggestions - Elections > > > Hmmm....I took a look at that page and was pleased to see > > that I follow the standards closely, but I've never used a > > "corresponding constraint name"... > > > I've always used what I considered foreign keys, by using > > the Primary Key of one table in another as a linking > > field, like the Customer_ID in the Order table...but what's > > the purpose of a "corresponding constraint name" and the > > FKn...etc., as described below? > > > Rick > > > The corresponding constraint names should be the table > > name followed by _FKn > > where n = 0..9 (e.g., ADDRESS_FK1, ADDRESS_FK2) > > Typically you would want the naming convention applied to the foreign > key constraints if you're in the habbit (or environment) of creating > and dropping them using hand-crafted SQL scripts. I used to work for a > company in Orlando where this was the case several years ago (just > before the dot-com collapse), although unfortunately most of the > companies I've worked for have taken an alternate route and simply > decided that foreign-key constraints are not to be used (BLECH!). I > use foreign-key constraints consistently in my own work but always > handle them in an automated fashion, so I never have any real need for > a naming convention, since I'm not hand-coding the create or drop > statements generally speaking. > > I am of course, assuming that you know the difference between a > foreign-key constraint (which ensures data integrity by producing an > error if an insert/update/delete statement would create a conflicting > state in the data - in other words it doesn't allow the database to > ignore errors in your code), and simply having two tables which are > joined in your ad-hoc queries. The former is what I use - the latter > is what I'm forced to work with at my day-job. > > s. isaac dealey 954.522.6080 > new epoch : isn't it time for a change? > > add features without fixtures with > the onTap open source framework > > http://macromedia.breezecentral.com/p49777853/ > http://www.sys-con.com/author/?id=4806 > http://www.fusiontap.com > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200642 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

