A data type is a classification of data which tells the compiler or interpreter how the programmer intends to use the data. Most programming languages support various types of data, including integer, real, character or string, and Boolean.
Common data types used in programming
- Integer (int) : It is the most common numeric data type used to store numbers without a fractional component (-707, 0, 707).
- Floating point (float) : It is also a numeric data type used to store numbers that may have a fractional component, like monetary values do (707.07, 0.7, 707.00).
- Character (char) : It is used to store a single letter, digit, punctuation mark, symbol, or blank space.
- String (str or text) : It is a sequence of characters and the most commonly used data type to store text. Additionally, a string can also include digits and symbols, however, it is always treated as text.
- Boolean (bool) : It represents the values true and false. When working with the boolean data type, it is helpful to keep in mind that sometimes a boolean value is also represented as 0 (for false) and 1 (for true).
- Enumerated type (enum) : It contains a small set of predefined unique values (also known as elements or enumerators) that can be compared and assigned to a variable of enumerated data type. The values of an enumerated type can be text-based or numerical. In fact, the boolean data type is a pre-defined enumeration of the values true and false.
- Array : Also known as a list, an array is a data type that stores a number of elements in a specific order, typically all of the same type. Since an array stores multiple elements or values, the structure of data stored by an array is referred to as an array data structure.
- Date : Typically stores a date in the YYYY-MM-DD format.
- Time : Stores a time in the hh:mm:ss format. Besides the time of the day, it can also be used to store the time elapsed or the time interval between two events which could be more than 24 hours.
- Datetime : Stores a value containing both date and time together in the YYYY-MM-DD hh:mm:ss format.
- Timestamp : It is typically used by computer systems to log the precise date and time of an event, down to the number of seconds, in a format that is unaffected by time zones. Therefore unlike datetime, the timestamp remains the same irrespective of our geographical location.
We might be wondering why it is important to know about all these data types when we are mainly concerned with understanding how to leverage customer data. There is only one main reason — to gather clean and consistent data. Our knowledge of data types will come handy in two stages of our data collection efforts as described below.
Application of our knowledge on data types is not limited to data collection or instrumentation; other activities such as data integration and internal application development (using no-code or low-code tools) should also become a lot easier now that we understand the various data types.
7 Data Types: A Better Way to Think about Data Types for Machine Learning. Retrieved from https://towardsdatascience.com/7-data-types-a-better-way-to-think-about-data-types-for-machine-learning-939fae99a689
Computer Programming - Data Types. Retrieved from https://www.tutorialspoint.com/computer_programming/computer_programming_data_types.htm
Data Types. Retrieved from https://press.rebus.community/programmingfundamentals/chapter/data-types/
What are Data Types and Why are They Important? Retrieved from https://dataled.academy/guides/data-types/