In MySQL, and other databases, you can set what type of data a value in a table can be. Whether it’s text, a number, or even a file. This is used to prevent bad data from being added to the database and stop issues such as “bob +2”.
- There are numerous Data Types that can be used in MySQL. Even using a number can be an INT, FLOAT, DECIMAL and more.
- You use the Data Type most appropriate not just for the current use of the database, but which you expect will work in the future.
- You can create problems by using a Data Type setting that your use outgrows. So if you set a DECIMAL value to only accept 5 digits, but at some point you need to store 6 digits in that field this will case issues.
- Front End Validation is used to try to prevent bad data from being sent to the database.
- Acknowledgements from the MySQL database back end are used to prevent “silent failures” where data is not properly inserted into the database, but the user does not realize there is an issue.
- MySQL Reference – https://dev.mysql.com/doc/refman/8.0/en/data-types.html
- MySQLTutorial Cheat Sheet – http://www.mysqltutorial.org/mysql-data-types.aspx
Be the first to comment