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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:19:52+00:00 2026-06-09T12:19:52+00:00

I have ~38 columns for a table. ID , name , and the other

  • 0

I have ~38 columns for a table.

ID, name, and the other 36 are bit-sized settings for the user.

The 36 other columns are grouped into 6 “settings”, e.g. Setting1_on, Setting1_colored, etc.

Is this the best way to do this?

Thanks.

  • 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-09T12:19:53+00:00Added an answer on June 9, 2026 at 12:19 pm

    If it must be in one table and they’re all toggle type settings like yes/no, true/false, etc… use TINYINT to save space.

    I’d recommend creating a separate table ‘settings’ with 36 records one for each option. Then create a linking table to the user table with a value column to record the user settings. This creates a many-to-many link for the user settings. It also makes it easy to add a new setting–just add a new row to the ‘settings’ table. Here is an example schema. I use varchar for the value of the setting to allow for later setting which might not be bits, but feel free to use TINYINT if size is an issue. This solution will not use as much space as the one table with the danger of a large sparsely populated set of columns.

    CREATE TABLE `user` (
      `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
       `name` varchar(64) DEFAULT NULL,
      `address` varchar(64) DEFAULT NULL,
      PRIMARY KEY (`id`)
     ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    CREATE TABLE `setting` (
      `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
      `name` varchar(64) DEFAULT NULL,
       PRIMARY KEY (`id`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    
    CREATE TABLE `setting_user` (
      `user_id` int(11) NOT NULL DEFAULT '0',
      `setting_id` int(11) unsigned NOT NULL,
      `value` varchar(32) DEFAULT NULL,
      PRIMARY KEY (`user_id`,`setting_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a picture table which consists for users pictures Table Name:picture Columns: picture_id
I have a Name table with the columns NameID Name TypeID With the following
I have a DataGrid table with columns name , phone . In column name
I have a database with many tables and one particular table has columns: name
I have three tables, Name - columns Custpackingslipjour(table 1) - (deliverydate, dateclosed,, salesid) Inventrans
I have a table with columns 'id', 'name', 'value', 'uniqueConst' in both databases. Now
Lets say I have a table with columns such as: ID Name City State
I have a table in mysql which stores (among other columns) a bitmask as
Bit confused with this one. Basically, I have a column in a table, and
I have a table, 6 columns, the 6th column is empty but the other

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.