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 count rows with the count(*) function in ms sql server?

534


What is dml command?

542


What is dynamic cursor in SQL SERVER?

559


What are transactions and its controls?

610


Explain tables in SQL Azure?

94






Explain what role entity and relationship play in an ER diagram.

569


How to connect Azure federated root database and apply federation in entity framework?

87


What are drillthrough reports?

102


Explain the first normal form(1nf)?

549


Suppose you want to implement the following relationships while designing tables. How would you do it?a.) One-to-oneb.) One-to-manyc.) Many-to-many

516


Why it is recommended to avoid referencing a floating point column in the where clause?

532


What are parameterized reports? What are cascading parameters in ssrs reports?

100


What type of locking occurs during the snapshot generation? : sql server replication

862


What is triggers and stored procedures?

512


How can you find out which stored procedures are recompiling?

510