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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:26:25+00:00 2026-05-18T01:26:25+00:00

I am using the Toxi scheme for tagging items on my website. Being quite

  • 0

I am using the Toxi scheme for tagging items on my website. Being quite new to mysql let alone tagging, I’m just doing a sanity check. Here is my table initialization script.

CREATE TABLE IF NOT EXISTS Items (
  item_id INT UNSIGNED NOT NULL AUTO_INCREMENT ,
  item_name VARCHAR(45) NULL ,
  media_type VARCHAR(20) NULL ,
  file VARCHAR(45) NULL ,
  description VARCHAR(500) NULL ,
  PRIMARY KEY (item_id)
) ENGINE=InnoDB;

CREATE TABLE IF NOT EXISTS Tags (
 tag_id INT UNSIGNED NOT NULL AUTO_INCREMENT ,
 tag_text VARCHAR(25) NOT NULL ,
 PRIMARY KEY (tag_id) ,
 UNIQUE INDEX (tag_text)
) ENGINE=InnoDB;

CREATE TABLE IF NOT EXISTS Item2Tag (
 item_id INT UNSIGNED NOT NULL ,
 tag_id INT UNSIGNED NOT NULL  ,
 PRIMARY KEY (item_id, tag_id) ,
 INDEX (tag_id) ,
 FOREIGN KEY fk_Item (item_id) REFERENCES Items (item_id) ,
 FOREIGN KEY fk_Tag (tag_id) REFERENCES Tags (tag_id)
) ENGINE=InnoDB;

http://forge.mysql.com/wiki/TagSchema

Question 1

Is my understanding correct that there is an entry in the “Item2Tag” table for every “item_id” to “tag_id”? It just seems like that is going to be a huge table when I have ~3000 items and each item could have ~5 tags. Is that not a concern/not really a big table?

Question 2

Could someone help me understand importance of having Foreign Keys/References? Why do I need those and what do they do?

  • 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-18T01:26:26+00:00Added an answer on May 18, 2026 at 1:26 am

    Question 1: Yes, that’s correct.

    Question 2: You don’t really need them for Toxi schema as far as I know. But they help you avoid having entries in the reference table while not in the item table. It’s more of a constrain to prevent headaches than a need. ie. You delete item number x, the entry associated to item number x also gets deleted.

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

Sidebar

Related Questions

No related questions found

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.