MySQL Column Types Cheatsheet

This is a free resource from my online course, From Idea To Launch, where I teach you how to build a full Laravel web application, step by step, at beginner's speed. Learn more →

Below, I’ve listed all the MySQL column types you should ever need to utilize when creating database tables.

And I’ve also listed common column options and settings for easy reference.


 

The MySQL column types

  • INT — a numeric integer value
  • VARCHAR — standing for “varied-length character”, used for shorter pieces of texts, like a name
  • TEXT — used for longer pieces of text, like a description
  • BOOLEAN — used for boolean, true/false, values
  • TIMESTAMP — used to store a combination date & time
  • DATE — a date; format: YYYY-MM-DD (e.g. February 1, 2000 would be 2000-02-01)
  • TIME — a time; format: HH:MM:SS (e.g. 3 hours, 2 minutes, and 12 seconds would be 03:02:12
  • DATETIME — a point in time, a date and time; format: YYYY-MM-DD HH:MM:SS (e.g. November 26, 2015 at 3:30pm and 23 seconds would be 2015-11-26 15:30:23)
  • YEAR — a year, e.g. 1776
  • DECIMAL — used to store a decimal numeric value
  • ENUM — used to store a multiple choice value, where only one value can be selected
  • SET — used to store a multiple choice value, where multiple values can be selected

Common MySQL column options & settings

  • Null — designates that a column is optional
  • PRIMARY, or primary key — says says to the database table: “this column contains each object’s unique identifier!”
  • A_I, or auto-incrementautomatically assign each newly-created object the next available integer value
  • Length — used to specify the number of characters allowed for CHAR and VARCHAR columns
  • Values — used to specify the values available for ENUM and SET columns