Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Table Related to 2 Parents?

Author  Topic 

TDC
Starting Member

5 Posts

Posted - 2010-03-16 : 13:50:51
Hello, and thank you for taking the trouble to look at my question.

I am developing a database for a Content Management System I plan to develop. The ASP website which will access this database will deliver training to users and I have organised the content in a simple set of related Tables as follows:

Topics, Lessons, Sub-Sections, Screens, Text.

A Topic can contain many Lessons.
A Lesson can only be related to 1 Topic and will contain 1 or more Sub-Sections.
A Sub-Section can only be related to 1 Lesson and will contain 1 or more Screens.
A Screen can only be related to 1 Sub-Section and will contain 1 or more Text elements.

So far so good!

Additionally I have a Course Table. A Course is simply a collection of Lessons with a 'many to many' relationship, through a junction table, since a Course can contain many Lessons and a Lesson can belong in many Courses.

So to my problem. Each Course has an Introduction and a Summary which can only be related to a single Course. Let's take the Introduction. The Introduction comprises 1 or more Sub-Sections which comprise 1 or more Screens etc.

I would like to create an 'IntroSummary' Table and relate this to the Course. Can I use the Sub-Section > Screen > Text set of tables to hold the content? The problem being that Sub-Sections are also children of Lessons.

Is it possible for my Sub-Section Table to have a LessonId field and an IntroSummaryId field which both allow NULLS and use these for Primary Keys in both relationships?

I would like to be able to create Sub-Section records as children of either a Lesson record or a IntroSummary record.

Please do not hesitate to question me if this is not clear, it is difficult to describe.

Regards

Chris

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-04-03 : 12:41:37
Provide the table structure and sample data.
Also show us what you have done till now..


Regards,
Bohra
Go to Top of Page
   

- Advertisement -