4 MySQL Data Types

In this chapter, you’ll look at all of the available MySQL data types. You’ve already seen that int and varchar can be used for integer and character data, but MySQL also has data types to store dates, times, and even binary data. You’ll explore how to choose the best data types for your columns and the pros and cons of each type.

When you create a table, you define each column’s data type based on the kind of data you’ll store in that column. For example, you wouldn’t use a data type that allows only numbers for a column that stores names. You might additionally consider the range of values that the column will have to ...

Get MySQL Crash Course now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.