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
What are the advantages of paper records?
How you would rewrite the sql query to return the customerid sorted numerically?
What is the security model used in sql server 2005?
What is inline variable assignment?
What are the differences between local and global temporary tables?
How to enter comments in transact-sql statements?
How to get the number of affected rows?
Write a query to include a constraint, to check whether the employee salary is greater than 5000?
What is catalog views?
How to create a view using data from another view?
What is database white box testing?
What are the different types of sub-queries?
What is right outer join in sql server joins?
Does sql server use t sql?
What is PROJECTION Operation?