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 6133333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:12:52+00:00 2026-05-23T17:12:52+00:00

Not sure if this is the best structure for my database but this is

  • 0

Not sure if this is the best structure for my database but this is what I have at the moment (open to suggestions for alterations). I basically want to create pages that have a user defined set of fields for each page. So I have four tables: pages, page_fields, page_data and data_fields.

pages:

id   name
 1   home

page_fields:

page_id field_id
   1       1
   1       2
   1       3

page_data:

 page_id  field_id  content
    1        1      'This is the Title'
    1        3      'Some description here'

data_fields:

id  field_name   field_type
1     title         text
2    subtitle       text
3   description    textarea

First of all is this a good database structure?
Secondly, how can I get the required fields as defined by the page_field table, the data (if there is any) for that field and the filed_name and filed_type given that we know the page id?

I presume there will be a couple of joins here but I just can’t work them out.

Any help appreciated.

  • 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-23T17:12:53+00:00Added an answer on May 23, 2026 at 5:12 pm
    1. Assuming that one field on one page can have single value, you can easily eliminate page_fields table. List of fields assigned to the page will be stored in page_data and if there is no content yet, NULL value will be in the content column.

    2. Something like SELECT * FROM page_fields INNER JOIN page_data ON (page_fields.page_id = page_data.page_id) INNER JOIN data_fields ON (page_data.field_id = data_fields.id);

    3. Additionally read about Entity Attribute Value model, may be it will generate some new ideas and generally useful for understanding things: http://en.wikipedia.org/wiki/Entity-attribute-value_model

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

Sidebar

Related Questions

So I'm not sure what the best way to accomplish this is, but basically
I'm not sure if this is the best way to do it, but I
I am not sure if I am going about this the best way, but
This should be easy, but I'm not sure how to best go about it.
I'm not entirely sure if this is the best way to word it, however,
I'm not sure how to best explain this, so this may be a bit
for sure this is not the best title. I'm creating a system to generate
Ok so this is alittle bit obscure and I'm not sure its the best
I find this comes up a lot, and I'm not sure the best way
Not sure this is a programming question, but we use LaTeX for all our

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.