O'Reilly logo

MySQL® by Paul DuBois

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Data Types

Virtually everything you do in MySQL involves data in some way or another because, by definition, the purpose of a database management system is to manage data. Even a statement as simple as SELECT 1 involves evaluation of an expression to produce an integer data value.

Every data value in MySQL has a type. For example, 37.4 is a number and 'abc' is a string. Sometimes data types are explicit, such as when you issue a CREATE TABLE statement that specifies the type for each column you define as part of the table:

CREATE TABLE mytbl
(
  int_col  INT,       # integer-valued column
  str_col  CHAR(20),  # string-valued column
  date_col DATE       # date-valued column
);

Other times data types are implicit, such as when you refer to literal values in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required