SQL Data Types

SQL data types define the kind of value a column can hold. Choosing the correct data type is essential for database performance, accuracy, and storage efficiency.

Each SQL database system (MySQL, SQL Server, MS Access, etc.) supports different data types. Always refer to your database documentation for compatibility. In our SQL playground, some data types and advanced features may not be supported, especially those that are platform-specific. If a feature is not supported in our playground, you may see a syntax error.

Tutorials dojo strip

SQL Data Types MySQL Data Types (Version 8.0)

In MySQL, data types fall into three broad categories: String, Numeric, and Date/Time.

String Data Types

Data TypeDescription
CHAR(size)Fixed-length string (0–255).
VARCHAR(size)Variable-length string (0–65,535).
TEXTHolds up to 65,535 characters.
TINYTEXTUp to 255 characters.
BLOBBinary Large Object (up to 65,535 bytes).
ENUM(val1,...)One value from a list.
SET(val1,...)Zero or more values from a list.

Note: In our SQL playground, only VARCHAR, CHAR, and TEXT types are reliably supported.

Numeric Data Types

Data TypeDescription
TINYINTVery small integer (-128 to 127).
SMALLINTSmall integer.
INT/INTEGERStandard integer (-2B to 2B).
BIGINTLarge integer.
FLOAT(p)Approximate floating point.
DOUBLEDouble-precision float.
DECIMAL(p,s)Fixed-point number.
BOOL/BOOLEANAlias for TINYINT(1) (0 = false, 1 = true).

Note: These are commonly supported in our playground.

Date and Time Data Types

Data TypeDescription
DATE‘YYYY-MM-DD’.
DATETIME‘YYYY-MM-DD hh:mm:ss’.
TIMESTAMPUnix epoch-based time.
TIMETime only.
YEARFour-digit year.

Note: DATE, DATETIME, and TIME are supported in our playground. TIMESTAMP might behave differently.

SQL Data Types SQL Server Data Types

SQL Server uses slightly different data types and naming conventions.

String Data Types

Data TypeDescription
CHAR(n)Fixed-length, non-Unicode.
VARCHAR(n)Variable-length, non-Unicode.
NCHAR(n)Fixed-length Unicode.
NVARCHAR(n)Variable-length Unicode.

Important: SQL Server–specific types like NVARCHAR are not available in our playground.

Numeric Data Types

Data TypeDescription
BIT0 or 1.
TINYINT0 to 255.
SMALLINTSmall integer.
INTStandard integer.
BIGINTLarge integer.
DECIMAL(p,s)Exact decimal.
FLOAT, REALApproximate decimals.

Note: INT, FLOAT, DECIMAL, and BIT are supported in the playground.

Date and Time Data Types

Data TypeDescription
DATEDate only.
DATETIMEDate and time.
SMALLDATETIMELess precision.
TIMETime only.

Note: Precision might vary. Use DATE, DATETIME, and TIME in the playground.

Other Data Types

Data TypeDescription
UNIQUEIDENTIFIERGUID
XMLXML formatted data
SQL_VARIANTStores various types
TABLE, CURSORAdvanced types

Important: Not supported in our playground.

SQL Data Types MS Access Data Types

MS Access uses simpler data types suitable for desktop applications.

Data TypeDescription
TextUp to 255 characters.
MemoLong text (up to 65,536 chars).
Byte0 to 255.
Integer-32,768 to 32,767.
Long-2B to 2B.
Single, DoubleFloating point numbers.
CurrencyDecimal values for money.
AutoNumberAuto-increment field.
Date/TimeStores both date and time.
Yes/NoBoolean.
OLE Object, Hyperlink, Lookup WizardMultimedia or UI fields.

Note: MS Access-specific features like AutoNumber or OLE Object are not supported in our playground.

SQL Data Types Labs

Tutorials dojo strip