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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:55:56+00:00 2026-06-04T06:55:56+00:00

I’m designing a database for a new CMS and having some trouble structuring tables

  • 0

I’m designing a database for a new CMS and having some trouble structuring tables for files and images.

Current design is to have tables with file info:

  • files: name, filename, extension, lang, size
  • images: name, filename, exstension, alt

Above them are tables for specific types named: product_files, article_files.
They have fields like (for product and images): id, image_id, product_id, position.

These tables are there because it can happen that different products have same images.
The thing is, I’m repeating those middle tables for every use case (2 for products, 2 for articles, etc.).

I was thinking of combining them in one table like:

  • items_images with columns: table, table_id, image_id, position

Is that a good way to go? Or should I leave it as is? To my knowledge I can’t set foreign keys on a table like that connecting it to tables of products or articles.

Edit:

It seems I wasn’t very clear about the problem. I don’t know how to best display it here so I’ll explain the picture (https://i.stack.imgur.com/wwUjM.png): tables structure Just ignore the lines.

Top row are tables with actual file info. Documents, images and videos respectively.
Middle row are six tables grouped into three and each group connected to their table (products and articles). What I would like to do is make only three out of those six but still keep them connected to both products and articles at the same time. Maybe the solution is some 4th table but I don’t know.

  • 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-04T06:55:57+00:00Added an answer on June 4, 2026 at 6:55 am

    You can use a table structure like :

    id, image_id, pointer_id, position, type

    where type will tell if it’s a product, article etc.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have thousands of HTML files to process using Groovy/Java and I need to
I have a reasonable size flat file database of text documents mostly saved in
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have some data like this: 1 2 3 4 5 9 2 6
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't

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.