2

I am creating a small database application. I want to store the count of an item in a database table which will never cross value more than one hundred.

What is the most suitable datatype for this field? I am using this field for some calculation also.

0

3 Answers 3

4

use tinyint - one byte of storage space

Sign up to request clarification or add additional context in comments.

Comments

3

While you can use TinyInt, are you sure it will never be more than a hundred? I'd be careful about trying to optimize TOO much. Maybe it's something like a rating where ratings are always between 0 and 100, but if it's something that could potentially go over that at some point in the future, I might just go with a traditional Int. Maybe you need all the memory you can get so you need to really watch what values you use but this isn't too common.

I guess what I'm trying to say is don't get too aggressive about optimization of something that will generally not make much difference at all.

Comments

1

Tinyint. Allows you to store values from 0 to 255.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.