0% found this document useful (0 votes)
2 views2 pages

MySQL Data Types

The document provides an overview of various data types used in databases, including numeric, string, binary large object (BLOB), and date/time data types, along with their characteristics and storage requirements. It also outlines SQL commands categorized into Data Definition Language (DDL), Data Manipulation Language (DML), Data Control Language (DCL), Transaction Control Language (TCL), and Data Query Language (DQL). Each data type is detailed with its range, size, and storage specifications.

Uploaded by

subhransu843
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

MySQL Data Types

The document provides an overview of various data types used in databases, including numeric, string, binary large object (BLOB), and date/time data types, along with their characteristics and storage requirements. It also outlines SQL commands categorized into Data Definition Language (DDL), Data Manipulation Language (DML), Data Control Language (DCL), Transaction Control Language (TCL), and Data Query Language (DQL). Each data type is detailed with its range, size, and storage specifications.

Uploaded by

subhransu843
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

The type of values are fixed or variable.

 NUMERIC:
These datatypes can include exact numeric datatypes
For ex: integer, float, bits

DATATYPE SIGNED UNSIGNED STORAGE


NAMES
TINYINT -128 to 127 0 to 255 1 Byte
(very small
integer)
SMALLINT -32768 to 32767 0 to 65535 2 Bytes
MEDIUMINT -8388608 to 8388607 0 to 16777215 3 Bytes
INT -2147483648 to 0 to 4294967295 4 Bytes
2147483647
BIGINT -9223372036854775808 0 to 8 Bytes
to 18446744073709551615
9223372036854775807

 FLOAT(m,d):
It is a floating-point number that cannot be unsigned. It defines the display length(m) and the
number of decimals(d).
For ex: float(10,2) which means 10 is the total number of digits including decimals where 2 is
the number of decimals.
It takes 24 places and requires 2 Bytes for storage.
 DOUBLE(m,d):
In this datatype decimal decision can go to 53 places and it requires 8 Bytes for storage.
It cannot be unsigned.
 DECIMAL(m,d):
In this datatype each decimal corresponds to byte.
 BIT(m):
It is used to store the bit values into the table column.
Here m defines number of bit per value that has a range of 1 to 64.
 BOOL:
It is used only for the true and false condition. It is considered numeric value 1 as True and 0
as False.
 BOOLEAN:
Similar to BOOL.
 STRING DATATYPES
The string datatypes is used to hold plain text and binary data.
NAME MAX SIZE FIXED/VARIABLE
CHAR(size) 255 characters Fixed length string
VARCHAR(size) 255 characters Variable length string
TINYTEXT(size) 255 characters Number of characters to store
TEXT(size) 65535 Number of characters to store
MEDIUM(size) 16777215
LONGTEXT(size) 4GB or 4294967295
BINARY(size) 255 characters Number of binary characters
stored or fixed length string
VARBINARY(size) 255 characters Variable length string
 BINARY LARGE OBJECT DATATYPE (BLOB): These are BLOB (Binary Large Object) data
types used in databases like MySQL to store large binary data (e.g., images, videos, audio files, or
documents).
TINYBLOB It can hold a max size of 255 bytes
BLOB It can hold a max size of 65535 bytes
MEDIUMBLOB It can hold a max size of 16777215 bytes
LONG It can hold a max size of 4GB/ 4294967295
bytes

 DATE AND TIME DATATYPES


This datatype is used for temporal values such as date, time, datetime, timestamp and year
DATATYPE RANGE/SIZE STORAGE FORMAT
Year[(2/4)] 2 digits or 4 digits 1 Byte YYYY
DATE 1000-01-01 to 3 Bytes YYYY-MM-DD
9999-12-31
TIME 00:00:00 to 3 Bytes HH:MM:SS
838:59:59
DATETIME 1000-01-01 5 Bytes YYYY-MM-DD
00:00:00 to HH:MM:SS
9999-12-31
23:59:59
TIMESTAMP(m) 1970-01-01 4 Bytes YYYY-MM-DD
00:00:01 to HH:MM:SS
2038-01-19
03:14:07

SQL COMMANDS

DDL DML DCL TCL DQL

CREATE INSERT GRANT COMMIT SELECT

DROP UPDATE REVOKE ROLLBACK

ALTER DELETE SAVEPOINT

TRUNCATE LOCK

You might also like