Re: Creating tables, mapping from ER diagrams
Date: Wed, 04 Jan 1995 23:07:57 -0500
Message-ID: <dscott-0401952307570001_at_dscott.is.net>
In article <D1vFyB.7pp_at_mail.auburn.edu>, moorthy_at_eng.auburn.edu wrote:
> Hello Everyone,
>
> When we create tables, we mention primary keys and foreign keys
according to Entity - Relationship diagrams. For example,
>
> CREATE TABLE ORD (
> ORDID NUMBER (4) NOT NULL,
> ORDERDATE DATE,
> COMMPLAN CHAR (1),
> CUSTID NUMBER (6) NOT NULL,
> SHIPDATE DATE,
> TOTAL NUMBER (8,2) CHECK (TOTAL >= 0) CONSTRAINT TOTAL_ZERO,
> FOREIGN KEY (CUSTID) REFERENCES CUSTOMER (CUSTID) CONSTRAINT ORD_FOREIGN_KEY,
> PRIMARY KEY (ORDID) CONSTRAINT ORD_PRIMARY_KEY);
>
> After creating the tables, desc table_name will not show the information
regarding primary and foreign keys.
>
> SQL> desc ord;
> Name Null? Type
> ------------------------------- -------- ----
> ORDID NOT NULL NUMBER(4)
> ORDERDATE DATE
> COMMPLAN CHAR(1)
> CUSTID NOT NULL NUMBER(6)
> SHIPDATE DATE
> TOTAL NUMBER(8,2)
>
>
> Is there any way to see the table definitions with primary and foreign
keys after creating them ? This will be very helpful when we are
following up some other's work.
>
Check out the DBA_CONSTRAINTS table! It has all the information you are
seeking; OWNER, CONSTRAINT_NAME, CONSTRAINT_TYPE, TABLE_NAME,
SEARCH_CONDITION, R_OWNER, R_CONSTRAINT_NAME, DELETE_RULE, STATUS. The
information is contained on page B-28 of the Administrator's Guide.
-- David Scott ...how can I keep from singing? email: dscott_at_is.netReceived on Thu Jan 05 1995 - 05:07:57 CET