Account
Categories

MySQL Data Type


A data type defines the kind of data that a column can store in a table.

For example when, you want to store numbers like age or salary, you'll use a numeric data type.

If you want to store names or addresses, you'll use a text data type.

Example:

CREATE TABLE Person_tbl (
    id INT,
    name VARCHAR(100),
    age INT,
    is_active BOOLEAN
);

In the above:

  • INT → for whole numbers
  • VARCHAR(100) → for text (max 100 characters)
  • BOOLEAN → for true/false values