Book Image

Building a Web Application with PHP and MariaDB: A Reference Guide

By : Sai S Sriparasa
Book Image

Building a Web Application with PHP and MariaDB: A Reference Guide

By: Sai S Sriparasa

Overview of this book

Table of Contents (17 chapters)
Building a Web Application with PHP and MariaDB: A Reference Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

String datatypes


Let us look at the following main datatypes:

Datatype

Explanation

Comments

CHAR(L)

This stores a fixed-length string between 0 and 255 bytes.

Trailing spaces are removed.

VARCHAR(L)

This stores a variable-length string between 0 and 65,535 characters.

65,535 is the effective maximum row size for table.

TEXT

This stores character data and the maximum length of a text column is 65,535 characters.

Length need not be specified.

TINYTEXT

This stores the text column with a maximum length of 255 characters.

 

MEDIUMTEXT

This stores the text column with a maximum length of 16,777,215 characters.

 

LONGTEXT

This stores the text column with a maximum length of 4,294,967,295 characters.

 

BLOB

This stores binary data and the maximum length of a text column is 65,535 bytes.

Binary Large Objects are used to store binary data such as images.

TINYBLOB

The BLOB datatype column with a maximum length of 255 bytes.

 

MEDIUMBLOB

This stores the text column with a maximum length of 16,777,215 bytes.

 

LONGBLOB

This stores the text column with a maximum length of 4,294,967,295 bytes.

 

ENUM

This provides a list of strings from which a value can be chosen.

A list of 65,535 values can be inserted into the ENUM datatype.

SET

This is similar to the ENUM datatype. It provides a list of strings from which zero or more values can be chosen.

Can have a maximum of 64 distinct values.