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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:44:08+00:00 2026-06-02T13:44:08+00:00

This is a simple question, but I think I always used the wrong way.

  • 0

This is a simple question, but I think I always used the wrong way.

I have three tables called Page -> Tag -> Attribute. The Tag table receives the Page_Id (foreign key) and the Attribute table receives the Tag_Id (foreign key).

The Attribute table must receive the Page_Id too?

I never did this, but I saw a database SQL generator that does this, and so, I realized that this turns all the work easier, but this is the right way too?


Edit with details of the tables: The Page table contains HTML pages and some attributes like the content, the title, doctype and all other single elements of a html page.

The Tag table contains the HTML tags of a html page with informations like the tag (a, p, br, h1, title, etc.) and the entire tag.

The Attribute table contains all the attributes of a tag and is like a Map with key and value where each entry is an attribute and a value.

Page contains multiple tags (1:N) and tag contains multiple attributes (1:N). Each table contains a unique identification.

  • 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-06-02T13:44:09+00:00Added an answer on June 2, 2026 at 1:44 pm

    This is one of those “it depends” situations – you don’t, logically need the value to be stored in Attribute, since you can derive this information by joining to Tag.

    But, in some circumstances, it may be useful for you to be able to “jump” from Attribute to Page without having to join to Tag. In such a situation, you can include Page_Id in Attribute, but you should add additional constraints to ensure that it isn’t inconsistent with the value stored in Tag.


    You would enforce this consistency by having two keys declared in Tag – the usual key you define (e.g. Tag_Id), and also a superkey on Tag_Id and Page_Id. You would then declare a foreign key constraint in Attribute that includes both columns, and references this superkey. Whether you do that instead of the foreign key constraint on just Tag_Id, or in addition to it, can also be a matter of preference/style.


    If it’s likely that Tags will change Pages, then you would normally declare the foreign key to the superkey as the one on which an UPDATE CASCADE occurs – in this way, if the Page_Id changes in the Tag table, that change will be automatically applied in the Attribute table.

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

Sidebar

Related Questions

This is a simple database security & performance question, but I've always used either
i think this is a simple question but I've searched around and can't seem
I think this is a simple question, but I can not find the answer
this may be a simple question but until now I always created a web
This is a simple question but I don't know how to construct a variable
This may seem like a simple question but i am getting an error when
This is probably a simple question but I can't seem to figure out how
This is a pretty simple question but I'm somewhat stumped. I am capturing sections
This might be a simple question but I'm just picking this up so please
This is probably a simple question but I am developing a web app in

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.