Hello. Welcome to Knowledge City's course on Microsoft Access 2021 Intermediate. My name is John Veron, and in these lessons, you will learn about field properties. In this lesson, I will show you about choosing the correct data type. As we've seen before, each field has a list of data types to choose from. Choosing the correct one is integral to having a good database design, and can also make a big difference in how easy your application is to use and how much work it takes to maintain. I'm going to go through the most important data types and explain what types of data they're best used for, and I'll also discuss some information commonly stored in databases and talk about what data type is best used to store them. Let me just create a table here we can use as a reference. Let's start with the string data type. Which in Microsoft Access is called either short text or long text. Short text can hold a maximum of 255 characters, while long text can hold up to 65,536. In general, always use short text unless you're sure you need more than 255 characters, because a long text data type is handled differently internal to access, which can lead to slower performance or can require some special considerations. Text is the most general data type, meaning you can technically store anything in there, numbers, dates, currency, or whatever else you can think of. The problem is that no matter what you store in it, access won't see it as anything other than text. This means if you store numbers in here, you won't be able to compare them like normal numbers or perform math on them. If you store dates, you won't be able to check which dates come before others, so always use one of the other more specific data types whenever possible and only use a text type when nothing else will work. However, some pieces of data can look like a different data type but still fit best as text. A good example could be zip code. On the surface, a zip code looks just like a number, so you might be tempted to use a number data type. However, zip codes can contain a hyphen and you won't be able to put that in for a number data type. Therefore, it's often best to store zip codes as text. Besides, you usually won't have to perform math or comparisons on zip codes anyway. The number data type is probably the next most commonly used data type. This is best used for things that are just a number with no other parts to them. This one behaves a little differently from the other data types because it really depends on the field size property. That's this one right here. Changing the field size will essentially make this behave like a different data type. The size is byte, integer, and long integer will all treat the number as an integer, meaning they are round, whole numbers without a decimal portion. The difference between them is the maximum number they can store. For most purposes, integer is a good default size. Single, double, and decimal are all numbers that can store fractional decimal portions. Similar to the integers, the difference between these is the maximum number and precision that they can store. These could be used to store currency, but there is actually a data type that will work better for that. The currency data type is designed for storing money. It takes less storage space than the decimal data types, allowing only up to four decimal places. But that is more than enough for currency. It will also automatically add the currency symbol based on your locale and your operating system. Date time is exactly what it sounds like and is made for storing dates, times, or a combination of both. Dates and times stored in this data type can be compared and sorted, which you would be unable to do if they were stored as text. Yes, no is a special data type that can only have two possible values, yes and no, or sometimes referred to as true and false or one and zero. Other databases may call this type something like bool, boolean, or bit. They are all the same thing. This data type is great for storing any sort of flag, which is a toggle that can only have two possible values. Things such as whether a record is active or not. Note that if you combine this data type with making it not required, then the column will allow three possible values, yes, no, and no. So if you need a flag with three possible states, this is how you would do it. Hyperlink is a data type, which is just a special case of the text data type. You could put hyperlinks into either type, but if you use hyperlink, then access will automatically let you click on the link to open it. So you can choose text or hyperlink depending on whether you want users to be able to click the link or not. Attachment and OLE object are special data types that you won't normally need, but they are designed to store entire other files or application objects directly in your database. In general, unless you have a specific need to do this, it is best to avoid doing so. Hopefully, this gives you a good understanding of the main data types and to best use them effectively. Thanks for watching. Stay tuned for the next lesson where I will show you field formats.