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

Home -> Community -> Usenet -> c.d.o.misc -> Constraints question

Constraints question

From: Mark Framness <framnesso_at_my-deja.com>
Date: Wed, 22 Dec 1999 20:01:03 GMT
Message-ID: <83rals$4c2$1@nnrp1.deja.com>


Greetings All

I am preparing for the SQL-PL/SQL OCP exam. One of the practice exams I have been working with has a question that I get right, but I don't know why it is right.

The customer table is an existing table. CREATE TABLE sale
(purchose_no NUMBER(9),
 customer_no NUMBER(9),

   CONSTRAINT sale_customer_id_fk REFERENCES customer(id),
   CONSTRAINT sale_purchase_no_pk PRIMARY KEY (purchase_no),
   CONSTRAINT sale_customer_no_nn NOT NULL (customer_no));

The question is which line causes an error?

I have always been answering the NOT NULL contraint definition and that is indeed the answer. My answer rested upon the assumption that columns that serve as foreign keys MUST be nullable. Is that assumption correct?

I know that a foreign key must be either null or filled with a value from the table.column that the column references. Defining a foreign key column not null means that all values in the column must be filled in and from its parent column.

My colleagues tell me that it is possible to create a column that is a foreign key and is not null, is that correct?

Thanks
--
From: Mark Framness
http://netnet.net/~farmer/index.html
All standard disclaimers apply anyone who say otherwise is itching for a

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Dec 22 1999 - 14:01:03 CST

Original text of this message

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