Login | Contact Us | Site Map | Resources

Data Manipulation

Home > MYSQL Tutorial > MYSQL Data Types And Operators

MYSQL Data Types

Data types are assigned to a MYSQL table when the table is first created.

Let's take a quick look at some of the basic data type options available:

Data Type Type of Data Stored In Data Type
TINYINT Numeric Type (-128 thru 127)
SMALLINT Numeric Type (-32768 thru 32767)
MEDIUMINT Numeric Type (-8388608 thru 8388607)
INT Numeric Type (-2147483648 thru 2147483647)
BIGINT Numeric Type (9223372036854775808 thru 9223372036854775807)
CHAR() Characters Without Trailing Spaces (0 thru 255)
VARCHAR() Characters With Trailing Spaces (0 thru 65535)
TINYTEXT Text With Maximum Length of 255 Characters
TEXT Text With Maximum Length of 65,535 Characters
MEDIUMTEXT Text With Maximum Length of 16,777,215 Characters
LONGTEXT Text With Maximum Length of 4,294,967,295 Characters
DATETIME Date/Time Type (0000-00-00 00:00:00)
DATE Date/Time Type (0000-00-00)
TIMESTAMP Date/Time Type (0000-00-00 00:00:00)
TIME Date/Time Type (00:00:00)
YEAR Date/Time Type (0000)

It's all a matter of picking the best option for the type of data that you plan to store, and sticking to the plan!

MYSQL Operators

MYSQL operators are most often used when searching for patterns. Let's review some of the most common operators:

Operator Description
AND, && Logical AND
= Assign a Value (As Part of a SET Statement, or As Part of the SET Clause In An UPDATE Statement)
/ Division Operator
= Equal Operator
>= Greater Than or Equal Operator
> Greater Than Operator
<= Less Than or Equal Operator
< Less Than Operator
LIKE Simple Pattern Matching
- Minus Operator
% Modulo Operator
!=, <> Not Equal Operator
NOT LIKE Negation of Simple Pattern Matching
||, OR Logical OR
+ Addition Operator
* Multiplication Operator

As we progress, you will see some of these operators used, and can begin to experiment with others.