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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:22:11+00:00 2026-05-16T08:22:11+00:00

I have a table whose size I’d like to keep down, and one of

  • 0

I have a table whose size I’d like to keep down, and one of the columns can be treated as a 5-byte unsigned integer. This is a column that I won’t need to search by.

MySQL offers integer datatypes

  • TINYINT, for 1-byte integers
  • SMALLINT, for 2-byte integers
  • MEDIUMINT, for 3-byte integers
  • INT, for 4-byte integers
  • BIGINT, for 8-byte integers.

But it also offers BIT(M), for 1 ≤ M ≤ 64. This stores (effectively) an unsigned integer from 0 to 2M-1. Is there a reason to avoid using a BIT(40) column to store a 5-byte integer? (As I said, I will not need to search by this column. Any difficulties relating to query execution speed may therefore be ignored.)

  • 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-16T08:22:12+00:00Added an answer on May 16, 2026 at 8:22 am

    MySQL treats BIT as textual data and not numbers. Usually this is the reason working with BIT should be avoided – it may be a little bit confusing. For example, we want to store number 57 in BIT(8) column. The number 57 will be stored as `b’00111001′ i.e. binary representative of 57. But it will be displayed as 9 as 57 is ASCII code of ‘9’. To get proper integer value you have convert columns data to numerical value. You can test this behaviour with:

    CREATE TABLE testbit(a BIT(8));
    INSERT INTO testbit VALUES (b'00111001');
    INSERT INTO testbit VALUES (57);
    SELECT a FROM testbit;
    SELECT a+0 FROM testbit;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 515k
  • Answers 515k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Since it's not inside the <textarea> you need to traverse… May 16, 2026 at 6:37 pm
  • Editorial Team
    Editorial Team added an answer INSERT INTO TableName (Field1, Field2, Field3) VALUES (1, 2, 3);… May 16, 2026 at 6:37 pm
  • Editorial Team
    Editorial Team added an answer You're using float for storage, but you comparisons are being… May 16, 2026 at 6:37 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm using SQL Server 2005. I have a table whose row size should be
I have a table whose header looks like this (I've simplified it): id, a1,
I have a table with one column source_id whose value should be the primary
I would like to have a table in my Oracle database whose rows act
This question is related to this one . I have a page table with
I have to retrieve only particular records whose sum value of size field is
I have two tables Table : 1, Name : NdcAwp, Columns-Ndc, AwpUnitCost Table :
Let's say I have a table called 'species' with 3 columns: 'Id', 'ancestorId' and
Hi I am faced with a difficult problem: I have a table (oracle 9i)
Having a bit of a special moment here. Basically I have a DB table

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.