Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6945769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:28:42+00:00 2026-05-27T13:28:42+00:00

I have this table, I bet that looking at the tables, you will know

  • 0

I have this table, I bet that looking at the tables, you will know my problem already 🙂

content_table
--------------------------------------
| id |   title   | type  | parent_id |
--------------------------------------
| 0  |   Root    | Page  |    0      |
|100 |   Home    | Page  |    1      |
|101 | Main Text |Section|    1      |
|102 |   About   | Page  |    1      |
|301 |    Foo    | Text  |   245     |
|302 | About Us  | Text  |   246     |
--------------------------------------

paging_table
---------------------------------
| page_id | section_id | rel_id |
---------------------------------
|   0     |     0      |    1   |
|  100    |    101     |   245  |
|  102    |    101     |   246  |
---------------------------------

section_options
----------------------------
| section_id | option_mask |
----------------------------
|   101      |   65535     |
----------------------------
*paging_table.page_id and paging_table.section_id 
  both have FOREIGN KEYs on content_table.id

 section_options.section_id has a FOREIGN KEY on content_table.id

So basically I have a CMS and I want to treat EVERYTHING as a content, be it a page, a page section, or the actual contents of the pages themselves.

Secondly, since some page sections will be quite similar, I decided that I need not create multiple sections (e.g. home_main_text, about_main_text, etc…). I just need to create a generic section and have the paging_table take care of the rest since sections will also have a whole lot of display options with them (stored in another table that has a reference to content_table.id). If I am to have similar sections with very similar options stored in two rows, that would look bad wouldn’t it?

Then I created a root content (the one with id = 0 at the content_table). All main pages and sections will have the root as their parent.

My problem now is that I want to put a FOREIGN KEY on parent_id that references to the rel_id column. But I have the Root element to worry about. I already feel like I am doing a hack on the first row of the paging_table. I am now feeling a chicken and egg scenario for the root content. Do you think there really is a necessity for the root content? How about the generic section approach? I just want a better design of this database :), or maybe an overall redesign of architecture of the CMS since I’m just starting and I really haven’t done much yet.

Criticisms are very much welcome (just be constructive). If there is anything vague, please comment and I will try to clear it up, I just am having a hard time articulating what I have in mind and it would really be a hassle if I simply sent you the source code the classes that I am building. Thanks!

EDIT

I’ve edited the id’s to make the references clear

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:28:43+00:00Added an answer on May 27, 2026 at 1:28 pm

    I don’t really see a problem there. I would just leave the parent_id of Root to Null: it has no parent, and it is NOT his own parent.
    Otherwise, SQL Server (and probably some other RDBMS) has hierarchical capabilities.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this table that needs to have (for every row) the average cost
I have a table called RESULTS with this structure : resultid,winner,type And a table
I have this table in my Android SQLite DB: CREATE TABLE statistics (subject TEXT,
I have this table : select count(distinct clean_deep_link) from tbl_1; +---------------------------------+ | count(distinct clean_deep_link)
I have this table Ratings containing an USER_ID, Artist_ID and a Rating (int, the
I have this table similar to MySQL - get sum() grouped max() of group
I have this table insurance in SQL Server 2008 insuranceId StartDate EndDate CarID 1
I have this table CREATE TABLE [dbo].[friend_blocked_list]( [subdomain] [varchar](50) NOT NULL, [un] [nvarchar](50) NOT
I have this table CREATE TABLE `codes` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
i have this table in UTF8 (collation is utf8_bin in case it matters). I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.