How to make a parent and child table?
Parent and child
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
How to make a parent and child table?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Dipal ChoksiRank #199 · 12K reputationPosted May 13, 2008, 7:43 PM EDT
Create 2 tables with the primary key of the parent table set as foreign key of the child table (assuming 1-M parent-child relation)
eg.
Parent table:
ParentID INT IDENTITY(1, 1)
ParentField1 varchar(50)
ParentField2 int
etc
Child Table:
ChildID INT IDENTITY(1, 1)
ParentID int
ChildField1 int
ChildField2 varchar(15)
etc
Vijaya KadiyalaRank #1,085 · 1.8K reputationPosted Jun 24, 2008, 11:54 AM EDT
Hi
Basically you need to define PRIMARY KEY and FOREIGN KEY relationship to make two tables in PARENT-CHILD relationship.
Thanks -- Vj
http://dotnetvj.blogspot.com