Data Types

When you create a new table, you must decide on the data types for each column. You already encountered some of the general column types, such as VARCHAR and INT, in Lesson 14. Now let’s look at the most common data types in more detail.

Data Types

For a complete list of the data types you can use, refer to Appendix D, “MySQL Data Type Reference,” which can be found on the book’s website at www.samspublishing.com.

INTEGER

An integer is a whole number. The range of values that can be stored in an integer data type depends on the size of the integer—MySQL has five different sizes:

  • TINYINT can store numbers from –128 to 127, or 0 to 255 ...

Get Sams Teach Yourself MySQL 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.