Always choose the smallest data type. SQL cannot guess what you want the maximum value to be, but it can optimize storage and performance as soon as you specify the data type.
To respond to your update:
varchar takes up only as much space as you use, and therefore you are right when you say that the character βaβ will occupy 1 byte (in Latin encoding), no matter how large the varchar field is your choice. This does not apply to any other type of field in SQL.
However, you are likely to sacrifice space efficiency if you make the entire varchar field. If everything is a fixed-size field, then SQL can do simple constant-time multiplication to find your value (like an array). If you have varchar fields, then the only way to find out where the data is stored is to look at all previous fields (for example, a linked list).
If you are starting SQL, then I advise you to just stay away from varchar fields unless you expect to have fields that sometimes have very little text and sometimes a very large amount of text (like blog posts). It takes experience to know when to use variable length fields for the best effect, and I donβt even know most of the time.
source share