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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:18:39+00:00 2026-05-15T04:18:39+00:00

I new in database design. I have a question with my own few solution,

  • 0

I new in database design.

I have a question with my own few solution, what do you think?

Which tables should be created for all the kinds files that stored in my online store (images, attached email files, text files for store email body, etc.) ?

option 1: use seperate table for files types

files{
id
files_types_id FK
file_path
file_extension
}

files_types
id
type_name (unique)
}

option 2: use bool field for each file type

files{
id
file_path
file_extension
is_image_main
is_image_icon
is_image_logo
is_pdf_file
is_text_file
}

option 3: use one ENUM field ‘file_type’ for each file type

files{
id
file_path
file_extension
file_type (image_main,image_icon,image_logo,image_main,pdf,text) **enum**
}

Thank you, Yosef

  • 1 1 Answer
  • 1 View
  • 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-15T04:18:39+00:00Added an answer on May 15, 2026 at 4:18 am

    I would go with option 1 — it’s the “classic” fully normalized form.

    I think of option 3 as the “poor man’s normalization” — the column is still constrained to the limited set of types, but you don’t make the list of possible types available to database users. (In SQL Server, this would be done with a CHECK constraint.) Depending on your project and the (lack of) relevance of the data this can be worth doing, but “file type” information is useful and important and I wouldn’t want to hide it.

    To be complete, I’ll toss in Option 4: create one table for every type of file:

    files_text{ 
    id 
    file_path 
    file_extension 
    } 
    
    files_pdf{ 
    id 
    file_path 
    file_extension 
    } 
    
    files_image_main{ 
    id 
    file_path 
    file_extension 
    } 
    
    etc.
    

    This structure too can have its place, but it is generally horrible design, and you are wise not to have listed it. (Hmm, what does that make me?)

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

Sidebar

Related Questions

I am relatively new to database design. I have a database which has the
I'm new to database design and just wanted a few opinions as to whether
I am creating a new database to manage wish lists. Solution A: Two tables,
I have a general Database Design question: When is it better to create a
I have a potentially stupid question about a potentially stupid database design. Say I
My question is related to Database Design for Revisions? but more complicated. I have
My question relates to the best practices design of tables in a database for
I am pretty new to database design. I am building a small asp.net mvc
I am new to database schema design and I want to learn more about
I'm really new to database object design so please forgive any weirdness in my

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.