Technical Discussion :: SQL
Home > Technical Interview Q&A > SQL > Discussion
32 / 108
Can Primary key is a Foreign Key on the same table?
Answer:
Yes, Consider a category table in a e-commerce web site.
Category_Id, Category_Name, Parent_Category_ID. In this table all the parent categories are also categories. When we create a self join category id will be treated as foreign key to the same table.
Asked In ::
Priyanka Singh
23 Feb, 2019 5:07 AM
Yes, Consider a category table in a e-commerce web site.
Category_Id, Category_Name, Parent_Category_ID. In this table all the parent categories are also categories. When we create a self join category id will be treated as foreign key to the same table.
Category_Id, Category_Name, Parent_Category_ID. In this table all the parent categories are also categories. When we create a self join category id will be treated as foreign key to the same table.