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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:31:56+00:00 2026-05-14T15:31:56+00:00

Database newbie here. I’m setting up a mysql table. One of the fields will

  • 0

Database newbie here. I’m setting up a mysql table. One of the fields will accept a value in increment of a 0.5. e.g. 0.5, 1.0, 1.5, 2.0, …. 200.5, etc.

I’ve tried int but it doesn’t capture the decimals.

`value` int(10), 

What would be the smallest type that can accommodate this value, considering it’s only a single decimal.

I also was considering that because the decimal will always be 0.5 if at all, I could store it in a separate boolean field? So I would have 2 fields instead. Is this a stupid or somewhat over complicated idea? I don’t know if it really saves me any memory, and it might get slower now that I’m accessing 2 fields instead of 1

`value` int(10), 
`half` bool,  //or something similar to boolean

What are your suggestions guys? Is the first option better, and what’s the smallest data type in that case that would get me the 0.5?

  • 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-14T15:31:57+00:00Added an answer on May 14, 2026 at 3:31 pm

    You’ll want to look at the DECIMAL(P,S) type.

    For that, P is the precision and S is the scale. You can think of P as how many digits there are in total (both before and after the decimal point), and S as how many of the digits are after the decimal point.

    So for instance, to store from -999.99 to 999.99, you’d need 5 digits of precision and a scale of 2, therefore you’d use DECIMAL(5, 2).

    In your case, you’d need a DECIMAL(n, 1), where n is how many digits you need before the decimal point + 1 for the decimal.

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

Sidebar

Related Questions

Database? Page variables? Enum? I'm looking for opinions here.
Which Database table Schema is more efficient and why? Users (UserID, UserName, CompamyId) Companies
What database should a beginner use in the C language? Can I use MySQL?
Many database systems don't allow comments or descriptions of tables and fields, so how
This database will store a list of children. But the problem is, they will
A database application that I'm currently working on, stores all sorts of settings in
The Database Tuning Advisor is recommending that I create a bunch of statistics in
My database contains three tables called Object_Table , Data_Table and Link_Table . The link
The database type is PostGres 8.3. If I wrote: SELECT field1, field2, field3, count(*)
Our database server is a SQL 2008 server. My colleagues all have XP service

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.