Hello everyone,
I have a table called job.In the table two particular columns are empid and managerid.When I am creating the table I must ensure that the managerid should be an existing empid.How do I write the create table statement for this.I am using oracle 10g.
Thank you

try this

CREATE TABLE JOB
(EMP_ID NUMBER PRIMARY KEY,
MGR_ID NUMBER,
CONSTRAINT EMP_CONST1 FOREIGN KEY (MGR_ID) REFERENCES JOB (EMP_ID)
)

Thank you debasis da.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.