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

  • Home
  • SEARCH
  • 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 8463275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:24:40+00:00 2026-06-10T14:24:40+00:00

It will be better to explain my question on a example. Here is sample

  • 0

It will be better to explain my question on a example. Here is sample tables (InnoDB):

— posts

  • id
  • title
  • title_slug
  • content

— tags

  • id
  • name
  • name_slug

— post_tag_relation

  • postID
  • tagID

Let say I am creating simple post system with tag and I insert into post_tag_relation which posts have which tags. postID and tagID are referenced from their table. Here is my question, should I specify id (primary key) in post_tag_relation or is there a better way to create it? What do you suggest to create post_tag_relation table?

  • 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-10T14:24:41+00:00Added an answer on June 10, 2026 at 2:24 pm

    You don’t need to specify a seperate ID field for the post_tag_relation table. The combination of postID and tagID should be unique and can form a compound key. The posts and tags tables form a many-to-many relationship and a junction table (like your post_tag_relation table) is used to relate them. If you don’t want to store additional information about the relationship between a tag and a post (e.g. a timestamp indicating when the tag was associated with the post) then the only fields you need in the post_tag_relation table are the foreign keys from the posts and tags tables (ie. postID and tagID).

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

Sidebar

Related Questions

I'll start with an example and hopefully it will help explain my question. Say
I will explain the question by example: In zend framework, when you want to
Here is an example to explain what I need: I have 3 tables: contact:
I have this question. But it will be difficult for me to explain as
This is my first question here, but I hope I will get a lot
Which will perform better when searching for a key with a specific prefix in
Which code snippet will give better performance? The below code segments were written in
which one will be better to use default magic quotes or user defined addslash/stripslash
What will flood the network better? 1- Opening one socket to http web server
I am unsure on which approach will give me a better performance: I have

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.