Database Expert - "ENFORCE FROM", "ENFORCE TO", etc.

Could someone explain to me how the different enforce options work and how they affect data between tables?   I'm a little lost on the relationship.
Who is Participating?
frodomanConnect With a Mentor Commented:

Yes, you could accomplish the same thing with an inner join or outer join.  My understanding (and I'm not a DBA so this isn't my best topic of discussion) is that 'enforce from' and 'enforce to' basically are the equivalent of joins.  

Maybe if you can explain where you are seeing this used it would help?  Where I've seen it, is a case where relationships between tables are pre-defined but you're pulling a query that may or may not use the defined relationship (enforce both = inner join, enforce from / to = outer join left / right).

Here's a very generic description, but the implementation of this really depends on the specific database you're working with.

Enforced From:
When you select this option, if the "to" table for the link is used, the link is enforced. For example, if you create a link from Table A to Table B using Enforce From and select only a field from Table B, the Select statement will still include the join to Table A because it is enforced. Conversely, selecting only from Table A with the same join condition will not cause the join to Table B to be enforced.

Enforced To:
When you select this option, if the "from" table for the link is used, the link is enforced. For example, if you create a link from Table A to Table B using Enforce To and select only a field from Table A, the join to Table B will be enforced, and the Select statement that is generated will include both tables.

trs28Author Commented:
well, i've read that ... but i'm looking more for a "real life" example where enforcing might be beneficial to use rather than just the general description.   thanks though!
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Real life example:  Say you have a table containing employees and another table containing job descriptions.  You'll want to enforce links if you wanted a list of job descriptions that have matching employees.  You won't enforce links if you want a list of all job descriptions, whether or not you have any employees with that job.

That's a highly simplified example but it should illustrate the point somewhat.
Are you using Business view in BOE?
trs28Author Commented:
wykabryan -
     I'm using Crystal Reports XI Developer to do internal and application reporting.  

frodoman -
     I see where you're going with that, but couldn't you accomplish the same thing with an inner join?  Elaborate on that a bit if you    
     wouldn't mind.  Here's where I'm going with that... For example, tell me how you'd setup your two tables (i.e. the way you'd
     connect them & on what fields, which way you enforce a link, etc.).  If you could do that, and then tie that back to why you
     enforced a like and what it will do for you (relating to your scenerio above), that'd be damn wonderful!   Thanks!

(by the way, i bumped the points up a little for ya)
trs28Author Commented:
Well I've noticed the option when I've connected tables when doing a new report in crystal.  I'm doing a report now that has me connecting custom datasets with more custom datasets to views ... it's a mess, but it's the best way to do what I'm accomplishing ...and I'm having trouble getting some of the data to appear ... so I figured, "hey, why not ask on experts exchange and see what everyone has to say"
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.