can foreign key take role of primary key?

Answer Posted / suresh murugadass

Yes. It is possible in this scenario. Here table has a
self join. Since emp_id represents both emp_id and mgr_id
this is possible a primary key to behave as foriegn key
create table emp(
emp_id int not null primarykey,
emp_name varchar2(40) not null,
mgr_id int not null foriegn key(mgr_id) references emp(emp_id)
}

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to add code to the existing article (using improve article)?

596


What are alternate keys?

576


Detail about query optimizer?

616


Explain identity in sql server?

568


Can we do dml on views?

555






How can you start sql server in different modes?

509


What are the tools available in market as an alternative to sql server reporting services?

88


What command do we use to rename a database?

619


What is page in sql server?

517


What are sql servers used for?

513


What is nested transaction?

538


What is stored procedures?

548


What is identity?

558


What is the full form of ddl?

512


I applied Transactional with updatable subscriptions replication on 2 tables now i want to delete those 2 tables but i cannot delete those tables as replication is running how can i stop replication for those 2 tables(but i don't want to delete those replicated tables but i need to stop the replication) how can i do that

1445