![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||||
| |||||
|
|
First, let me qualify my interests. I am primarily interesested in the mechanics of relational database management, not the semantics. I am interested in the evaluation of sql queries without regard to their meaning. A contradiction in your statement. You seem interested in relational |
|
1. without racking *your brain or searching the archives of your previous work, does your gut feeling tell you have ever authored or seen an sql query in which two relations were joined on a foreign key in each? Yes. No big deal. |
|
2. using your knowledge and understanding of (any) relational algebra, is a join between two relations on a foreign key in each ever meaningful? (Keep in mind the definition of the domain of a foreign key.) None particular. |
|
3. in the semantic realm you use to "think about" relational databases (i.e., E-R, facts, etc.), does a join between two relations on a foreign key in each make sense? JOIN is a relational operator. It can be used between any relation |
|
I request that you spend at least 10 minutes thinking about this before you flame me. No flames. Just simple answers as you requested. Rob |
#3
| ||||
| ||||
|
|
First, let me qualify my interests. I am primarily interesested in the mechanics of relational database management, not the semantics. I am interested in the evaluation of sql queries without regard to their meaning. 1. without racking your brain or searching the archives of your previous work, does your gut feeling tell you have ever authored or seen an sql query in which two relations were joined on a foreign key in each? |
|
2. using your knowledge and understanding of (any) relational algebra, is a join between two relations on a foreign key in each ever meaningful? (Keep in mind the definition of the domain of a foreign key.) |
|
3. in the semantic realm you use to "think about" relational databases (i.e., E-R, facts, etc.), does a join between two relations on a foreign key in each make sense? |
|
I request that you spend at least 10 minutes thinking about this before you flame me. |
#4
| |||
| |||
|
|
I've designed hundreds of databases. After contemplating it long and hard, I seriously doubt I ever used a foreignkey-foreign key join in the queries I authored for use with these databases. Not because it was disallowed, but because it lacks meaning. ... |
#5
| |||
| |||
|
|
Mechanically, there is nothing to it. ... |
#6
| |||
| |||
|
|
On Oct 1, 2:07*pm, Rob <rmpsf... (AT) gmail (DOT) com> wrote: ... I've designed hundreds of databases. After contemplating it long and hard, I seriously doubt I ever used a foreignkey-foreign key join in the queries I authored for use with these databases. Not because it was disallowed, but because it lacks meaning. ... There must be thousands of db's that have Shipments, Invoices and Receivables tables with a foreign key referencing a Customer table. Obviously there will be people who will want to join two or more of those tables to compare Shipment_Value to Invoice_Amount or Receivable_Amount. Of course there are probably thousands, maybe millions, of people who have designed hundreds of databases that used no such join. *And, probably thousands of people who have designed dozens of databases that used only such joins. In my original post, I asked (first) for a gut reaction. Yours is a |
#7
| |||
| |||
|
|
On Oct 2, 10:07*am, paul c <toledobythe... (AT) gmail (DOT) com> wrote: On Oct 1, 2:07*pm, Rob <rmpsf... (AT) gmail (DOT) com> wrote: ... I've designed hundreds of databases. After contemplating it long and hard, I seriously doubt I ever used a foreignkey-foreign key join in the queries I authored for use with these databases. Not because it was disallowed, but because it lacks meaning. ... There must be thousands of db's that have Shipments, Invoices and Receivables tables with a foreign key referencing a Customer table. Obviously there will be people who will want to join two or more of those tables to compare Shipment_Value to Invoice_Amount or Receivable_Amount. Of course there are probably thousands, maybe millions, of people who have designed hundreds of databases that used no such join. *And, probably thousands of people who have designed dozens of databases that used only such joins. In my original post, I asked (first) for a gut reaction. Yours is a gut reaction and happens to coincide with my own. But gut reactions can be misguided. For example, those people who "will want to join two or more of those tables to compare Shipment_Value to Invoice_Amount or Receivable_Amount" will likely do so THROUGH the Customer table so as to provide a Customer attribute that identifies the rows of the result. How many would do it without the Customer table? |
|
What I'm really trying to get at is whether a foreignkey-foreignkey join makes sense algebraically, |
|
and if so, do operations in higher-level abstractions (like E-R, facts) translate to them? |
#8
| |||
| |||
|
|
For example, those people who "will want to join two or more of those tables to compare Shipment_Value to Invoice_Amount or Receivable_Amount" will likely do so THROUGH the Customer table so as to provide a Customer attribute that identifies the rows of the result. How many would do it without the Customer table? ... |
|
What I'm really trying to get at is whether a foreignkey-foreignkey join makes sense algebraically, ... |
|
... and if so, do operations in higher-level abstractions (like E-R, facts) translate to them? |
#9
| |||
| |||
|
|
On 2 okt, 19:58, Rob <rmpsf... (AT) gmail (DOT) com> wrote: On Oct 2, 10:07*am, paul c <toledobythe... (AT) gmail (DOT) com> wrote: On Oct 1, 2:07*pm, Rob <rmpsf... (AT) gmail (DOT) com> wrote: ... I've designed hundreds of databases. After contemplating it long and hard, I seriously doubt I ever used a foreignkey-foreign key join in the queries I authored for use with these databases. Not because it was disallowed, but because it lacks meaning. ... There must be thousands of db's that have Shipments, Invoices and Receivables tables with a foreign key referencing a Customer table. Obviously there will be people who will want to join two or more of those tables to compare Shipment_Value to Invoice_Amount or Receivable_Amount. Of course there are probably thousands, maybe millions, of people who have designed hundreds of databases that used no such join. *And, probably thousands of people who have designed dozens of databases that used only such joins. In my original post, I asked (first) for a gut reaction. Yours is a gut reaction and happens to coincide with my own. But gut reactions can be misguided. For example, those people who "will want to join two or more of those tables to compare Shipment_Value to Invoice_Amount or Receivable_Amount" will likely do so THROUGH the Customer table so as to provide a Customer attribute that identifies the rows of the result. How many would do it without the Customer table? A (natural) JOIN is an associative operation. *To speak of joins as if they are "THROUGH a table" is to expose ones ignorance of the relational algebra, or it is to expose ones failure to properly distinguish between model (the JOIN itself) and implementation (the evaluation strategy as chosen by the engine that executes the query), or it exposes yet some other important piece of knowledge that is lacking in your brain. Take any set of 6NF relvars. *For example, CUST {CUST_ID} , CUST_DOB {CUST_ID, DOB} , CUST_SAL {CUST_ID, SAL} , with key CUST_ID in each and FK CUST_ID in the latter two. *Now write the query that gives me the customer ID of all the customers for which both date of birth and salary are known. *Hint : if you include my CUST relvar, then you've got a relvar too many. In spite of my ignorance, my failures and/or my brain deficiencies, |
#10
| |||
| |||
|
|
First, let me qualify my interests. I am primarily interesested in the mechanics of relational database management, not the semantics. I am interested in the evaluation of sql queries without regard to their meaning. 1. without racking *your brain or searching the archives of your previous work, does your gut feeling tell you have ever authored or seen an sql query in which two relations were joined on a foreign key in each? 2. using your knowledge and understanding of (any) relational algebra, is a join between two relations on a foreign key in each ever meaningful? (Keep in mind the definition of the domain of a foreign key.) 3. in the semantic realm you use to "think about" relational databases (i.e., E-R, facts, etc.), does a join between two relations on a foreign key in each make sense? I request that you spend at least 10 minutes thinking about this before you flame me. Rob |
![]() |
| Thread Tools | |
| Display Modes | |
| |