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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:35:26+00:00 2026-05-13T05:35:26+00:00

Consider a table whose job is to store a rating of an object. The

  • 0

Consider a table whose job is to store a rating of an object. The column of interest here is the one called RATING. The valid range of values to store is:

  • 1
  • 0
  • -1

The first thought was to store as a tinyint smallint. This would store only one byte two bytes per row. Given the tinyint’s range of 0 to 255 smallint’s range of -32768 to 32767, would it be suitable here? Is there another datatype more suitable? The space taken is trivial for the expected size of the table & database. The user interface will be responsible for ensuring that those three values will be chosen by way of an enum.

Question: can you suggest a smaller storage size or any clever setups to store one of these three values without sacrificing any ease-of-understanding?

Other considerations:

  • storage space isn’t a terribly large concern
  • this value will be summed to get a total rating
  • this may be a case of micro-optimization
  • SQL Server 2008
  • 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-13T05:35:26+00:00Added an answer on May 13, 2026 at 5:35 am

    smallint is the (ahem) smallest integer datatype that can accurately track -1, 0, and 1. If space is not an issue, and you have said that it isn’t, then use smallint. Anything else would be overly clever and would require far more implementation work than is necessary.

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

Sidebar

Related Questions

Consider a table with a bit column indicating whether the object is active or
Consider a simple table with an auto-increment column like this: CREATE TABLE foo (
Consider following table. I'm trying to write a query to display - Max values
I need to combine different row's values in table in oracle. For example, consider
Consider a table with a column amount, Amount -1235.235 1356.45 -133.25 4565.50 5023 -8791.25
Consider a table to store SSN and DOB. CREATE TABLE fbi ( ssn BIGINT,
Consider this table on SQL Server wordID aliasID value =========================== 0 0 'cat' 1
Consider a table or CTE structured like this: Name Num ---- ---- Abc 12
I am trying to accomplish this: Consider a table view with Search Bar on
For the sake of the example, consider a table create table foo ( contents

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.