6. Field Length

Once you have chosen your datatypes, you need to think about the best 'field length' for eachfield length field.

Most databases will have a default field length set up, in this case it is 50.

This means that each text field is able to store up to 50 letters, numbers or symbols.

In some situations, you may need to use all 50, but think about forenames. How long is the longest one you can think of? Probably around 12. What about surname? Even a double-barrel surname is unlikely to need more than 20 letters.

The reason that you shouldn't just leave the field length as the default number is because every single character space allowed takes up one byte of storage space in the database, so a field size of 50 would need 50 bytes of storage. On its own, that doesn't sound a lot, but multiply that by all of the fields in the database and then by every single record being stored and you could soon have a large and unwieldy database that becomes a bit slow and sluggish.

What field size do you think would be sensible for the following:

  • Postcode?
  • Telephone number?
  • Car registration number?
  • Town?
  • County?

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Database Field Length