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
How to count rows with the count(*) function in ms sql server?
What is dml command?
What is dynamic cursor in SQL SERVER?
What are transactions and its controls?
Explain tables in SQL Azure?
Explain what role entity and relationship play in an ER diagram.
How to connect Azure federated root database and apply federation in entity framework?
What are drillthrough reports?
Explain the first normal form(1nf)?
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
Why it is recommended to avoid referencing a floating point column in the where clause?
What are parameterized reports? What are cascading parameters in ssrs reports?
What type of locking occurs during the snapshot generation? : sql server replication
What is triggers and stored procedures?
How can you find out which stored procedures are recompiling?