Data type in MySQL Part - 2



Hello and welcome everyone. In the previous article, we have learned about Numeric Data type. Now in this article, we will learn String Data type. Let’s go.
MongoDB with .Net Core course link => https://www.udemy.com/mongodb-with-net-core-sagar-jaybhay/

Web API 2- .Net Core In depth In 5 Hours click on: https://www.udemy.com/web-api-2-net-core-in-depth-in-5-hrs-with-sagar-jaybhay/

String Data type
CHAR ()
VARCHAR ()
BINARY ()
VARBINARY ()
BLOB (Binary Large Objects) ()
TEXT ()
TINYBLOB ()
TINYTEXT ()
MEDIUMBLOB ()
MEDIUMTEXT ()
LONGBLOB ()
LONGTEXT ()
ENUM ()
SET ()
Now let see in details one by one:
CHAR ()

CHAR data type is a fixed length string (in this contain is letters, numbers and special characters), where size is the number of characters to store in the database. A char data type length is from 0 to 255. For example, is CHAR (10).

VARCHAR ()

VARCHAR data type is a variable length string (in this contain is letters, numbers, and special characters). When creating a VARCHAR field you must define a length. A VARCHAR data type length is from 0 to 255. For example, is VARCHAR (255).



BINARY ()

The BINARY data type is equal to CHAR () data type, but it stores binary byte strings in the database. Binary data type contains binary strings. Its length is from 0 to 255.

VARBINARY ()

VARBINARY data type is equal to VARCHAR () data type, but it stores binary byte strings in the database. VARBINARY data type contains binary strings. Its length is from 0 to 255.

BLOB (Binary Large Objects) ()

Binary Large Object (BLOB) contains a variable amount of data and its maximum length of 65535 characters. Binary Large Object used to store a large amount of binary data like images or other types of files and the stored data are case sensitive on BLOBs. You do not need to specify a length with BLOBs.

TEXT ()

TEXT data type holds a large amount of string data and a string with a maximum length of 65535 characters. TEXT stored size is String length + 2 bytes. The stored data are not case sensitive on TEXT. You do not need to specify a length with TEXT.

TINYBLOB ()

A TINYBLOB data type is a column with a maximum length of 255 characters. You do not need to specify a length with TINYBLOB.

TINYTEXT ()

A TINYTEXT data type holds a string with a maximum length of 255 characters. You do not need to specify a length with TINYTEXT.



MEDIUMBLOB ()

A MEDIUMBLOB data type is a column with a maximum length of 16777215 characters. You do not need to specify a length with MEDIUMBLOB.

MEDIUMTEXT ()

A MEDIUMTEXT data type holds a string with a maximum length of 16777215 characters. You do not need to specify a length with MEDIUMTEXT.

LONGBLOB ()

A LONGBLOB data type is a column with a maximum length of 4294967295 characters. You do not need to specify a length with LONGBLOB.

LONGTEXT ()

A LONGTEXT data type holds a string with a maximum length of 4294967295 characters. You do not need to specify a length with LONGTEXT.

ENUM ()

ENUM data type is an enumeration, which is that each column can have one of several possible values (with the maximum to be 65535 values). You are creating a list of items from which the values must be selected when defining an ENUM ().

SET ()

The SET data type is equal to ENUM () data type, but SET can have up to 64 list items and can store more than one choice at the time of table creation. SET data type 1, 2, 3, 4 or 8 bytes, depending on the number of set 64 members maximum.




NOTES:
In MySQL have many of the data types have equal names such as DEC and DECIMAL, INT and INTEGER, etc.
If the tables have multiple TIMESTAMP columns, then the first one will be updated when you performed INSET or UPDATE statement.


MongoDB with .Net Core course link => https://www.udemy.com/mongodb-with-net-core-sagar-jaybhay/

Web API 2- .Net Core In depth In 5 Hours click on: https://www.udemy.com/web-api-2-net-core-in-depth-in-5-hrs-with-sagar-jaybhay/


Comments

Popular posts from this blog

ALTER statement in MySQL

Order By Clause in MySQL

MySQL Constraint – UNIQUE