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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.