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.
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 Type | Description |
---|---|
CHAR(size) | Fixed-length string (0–255). |
VARCHAR(size) | Variable-length string (0–65,535). |
TEXT | Holds up to 65,535 characters. |
TINYTEXT | Up to 255 characters. |
BLOB | Binary 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
, andTEXT
types are reliably supported.
Numeric Data Types
Data Type | Description |
---|---|
TINYINT | Very small integer (-128 to 127). |
SMALLINT | Small integer. |
INT /INTEGER | Standard integer (-2B to 2B). |
BIGINT | Large integer. |
FLOAT(p) | Approximate floating point. |
DOUBLE | Double-precision float. |
DECIMAL(p,s) | Fixed-point number. |
BOOL /BOOLEAN | Alias for TINYINT(1) (0 = false, 1 = true). |
Note: These are commonly supported in our playground.
Date and Time Data Types
Data Type | Description |
---|---|
DATE | ‘YYYY-MM-DD’. |
DATETIME | ‘YYYY-MM-DD hh:mm:ss’. |
TIMESTAMP | Unix epoch-based time. |
TIME | Time only. |
YEAR | Four-digit year. |
Note:
DATE
,DATETIME
, andTIME
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 Type | Description |
---|---|
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 Type | Description |
---|---|
BIT | 0 or 1. |
TINYINT | 0 to 255. |
SMALLINT | Small integer. |
INT | Standard integer. |
BIGINT | Large integer. |
DECIMAL(p,s) | Exact decimal. |
FLOAT , REAL | Approximate decimals. |
Note:
INT
,FLOAT
,DECIMAL
, andBIT
are supported in the playground.
Date and Time Data Types
Data Type | Description |
---|---|
DATE | Date only. |
DATETIME | Date and time. |
SMALLDATETIME | Less precision. |
TIME | Time only. |
Note: Precision might vary. Use
DATE
,DATETIME
, andTIME
in the playground.
Other Data Types
Data Type | Description |
---|---|
UNIQUEIDENTIFIER | GUID |
XML | XML formatted data |
SQL_VARIANT | Stores various types |
TABLE , CURSOR | Advanced 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 Type | Description |
---|---|
Text | Up to 255 characters. |
Memo | Long text (up to 65,536 chars). |
Byte | 0 to 255. |
Integer | -32,768 to 32,767. |
Long | -2B to 2B. |
Single , Double | Floating point numbers. |
Currency | Decimal values for money. |
AutoNumber | Auto-increment field. |
Date/Time | Stores both date and time. |
Yes/No | Boolean. |
OLE Object , Hyperlink , Lookup Wizard | Multimedia or UI fields. |
Note: MS Access-specific features like
AutoNumber
orOLE Object
are not supported in our playground.