Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Design question : Nullable FK & FK To Unique Key

Re: Design question : Nullable FK & FK To Unique Key

From: <afatkulin_at_gmail.com>
Date: 9 Nov 2006 16:11:09 -0800
Message-ID: <1163117468.942307.175280@i42g2000cwa.googlegroups.com>


>
> It seems everyone is understanding something different from what the
> OP posted. My take was the following:
>
> CREATE TABLE order (
> order_id NUMBER
> invoice_id NUMBER);
>
> CREATE TABLE invoice (
> invoice_id NUMBER);
>
> Since an order can be part of one and only one invoice (assuming no
> back orders) then one could create an order today and invoice it,
> filling in the invoice number, tomorrow.
> --
> Daniel A. Morgan
> University of Washington
> damorgan_at_x.washington.edu
> (replace x with u to respond)
> Puget Sound Oracle Users Group
> www.psoug.org

So this one (with wrong understanding) is you :)

OP said:
"OR they can just input Invoice without order."

"FK from Invoice to Orders"

so opposite is true:

CREATE TABLE order (
order_id NUMBER primary key
);

CREATE TABLE invoice (
invoice_id number primary key,
order_id referencing order (order_id)
);

int your case - there is no such fing as "FK from Invoice to Orders". Received on Thu Nov 09 2006 - 18:11:09 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US