primary key is foreign key for the same table?

Answer Posted / javed a. khan

Yes this is possible and it will allow.

CREATE TABLE learn_01(book_id NUMBER,
book_name VARCHAR2(100),
book_genre VARCHAR2(100),
isbn_number NUMBER ,
author VARCHAR2(100),
ref_book_id NUMBER)


alter table learn_01 add constraint book_pk primary key (book_id)

alter table learn_01 add constraint foreign key book_rf (ref_book_id) references learn_01

ALTER TABLE learn_01 add CONSTRAINT book_fk1 FOREIGN KEY (book_id) REFERENCES learn_01(book_id);

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the data pump export utility?

635


How to see free space of each tablespace?

585


What is a proxy object?

574


How to convert dates to characters in oracle?

577


What exactly do quotation marks around the table name do?

540






What is translate in oracle?

615


What are the attributes of the cursor?

549


How to create a new table in oracle?

584


Explain alias?

703


What is a database table in oracle?

565


Assuming that you are an End User How to find that in the payment Batch some of the Invoice was  Missing To pay How to find That??

1265


How to put more than 1000 values into an oracle in clause?

579


How to list all tables in your schema?

597


How to assign values to variables?

574


what is port in oracle? how is it related to database application.

1427