MySQL Data types Introduction

MySQL Data types - Introduction

Explanation

MySQL Data types :


Definition : Data type is the characteristic of columns and variables that defines what types of data values they can store. The characteristic indicating whether a data item represents a number, date, character string, etc.
Data types are used to indicate the type of the field we are creating into the table. MySQL data types supports in three important categories:

Before creating a table, identify whether a column should be a text, number, or date type. Each column in a table is made of a data type. The size of the value should be the smallest value depending upon the largest input value.
For example, if the number of students in a school are in hundreds set the column as an unsigned three-digit SMALLINT(allowing for up to 999 values).
We should be concise in inserting a string of five characters long into a char(3) field, the final two characters will be truncated. It is better to set the maximum length for text and number columns as well as other attributes such as UNSIGNED.
Square brackets ('[' and ']') indicate optional parts of type definitions.
Now we slightly move to the overview of MySQL data types.

Ask Questions

Ask Question