Data types in Mysql / Mariadb

Numeric Data Types:

INT (Integer):  Int data type represents an integer of normal size. So simply it can used to store numeric value. There are also BIGINT, MEDIUMINT, SMALLINT and TINYINT which represent different range of integer values.

DECIMAL: Decimal data type represents numbers with specific floating values. Maximum permitted value is 65 and maximum decimals are 30. There are also FLOAT and DOUBLE to store numeric values with floating point.

BOOLEAN:  This data type associates a value 0 with “false” and a value 1 with true.

Date and Time Data Types: 

DATE:  The DATE data type represents a date in  “YYYY-MMDD” format.

TIME: The TIME data type represents a time in “hh:mm:ss” format.

DATETIME: The DATETIME data type represents date and time in “YYYY-MM-DD HH:MM:SS” format.

TIMESTAMP:  This data type represents a timestamp of the “YYYY-MM-DD HH:MM:SS” format.  It mainly used to insert current date and time of record insertion / updation and deletion process.

String Data Types

CHAR: This data type represents a fixed-length string. Default value is 1.

VARCHAR: This data type represents a variable-length string of 0 to 65535.

TEXT: This data type represents a text column with a maximum length of 65,535 characters. some more Text data types are MEDIUMTEXT, LONGTEXT and TINYTEXT.

ENUM: The ENUM data type represents a string object and allows only a single value from a given list.

SET: The SET data type represents a string object having zero or more values from a given list.

Leave a Reply

Your email address will not be published.

Enjoy the tutorial? Please spread the word :)

Follow by Email
Facebook
Facebook
Google+2k
Google+
http://hirdeshbhardwaj.com/2017/03/31/data-types-mysql-mariadb/
YouTube31
YouTube