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
src name sex a,male b,female c,male d,female Required output : male female a,b c,d tried pivot but was not successfull select * from src pivot (max(name) for sex in ('MALE','FEMALE'));
Are truncate and delete commands same? If so why?
Where do we use decode and case statements?
How to loop through a cursor variable?
How to create tables for odbc connection testing?
Does oracle charge for java?
How to assign values to variables?
What happens to indexes if you drop a table?
Differentiate between pre-select and pre-query?
Explain what are the type of synonyms?
What is a proxy class?
Select all the employees who were hired in last 2 years and who works in dept where max managers are working.
How to insert a new row into a table in oracle?
What is the quickest way to export a table to a flat file?
What is SQL access advisor in Oracle?