SQL Datatypes
In
a table, each column has a type. As we mentioned earlier, a SQL
datatype
is similar to a datatype in traditional programming languages. While
many languages define a bare-minimum set of types necessary for
completeness, SQL goes out of its way to provide types such as
MONEY
and DATE
that will be
useful to every day users. You could store a MONEY
type in a more basic numeric type, but having a type specifically
dedicated to the nuances of money processing helps add to SQL’s
ease of use—one of SQL’s primary
goals.
Chapter 15, provides a full reference of SQL types supported by MySQL or mSQL. Table 6.1 is an abbreviated listing of the most common types supported in both languages.
Table 6-1. The Most Often Used Datatypes Common to Both MySQL and mSQL
Datatype |
Description |
---|---|
INT |
An integer value. MySQL allows an |
REAL |
A floating point value. This type offers a greater range and
precision than the |
CHAR(length) |
A fixed-length character value. No |
TEXT(length) |
A variable length character value. In mSQL, the given length is used as a suggestion as to how long the strings being stored will be. You may store larger values, ... |
Get MySQL and mSQL now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.