SQL Dialects Reference/Data structure definition/Data types/Character types

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Character types[edit | edit source]

This page includes comparison tables which can be big and complex.

While it's perfectly all right to view them in their complete state, it is recommended to install a comparison tables extension that would allow to select particular columns of interest for comparison.

SQL version Feature Standard
SQL:2011
DB2 Firebird Ingres Linter MSSQL MySQL MonetDB Oracle
Vers. 11.x
PostgreSQL SQLite Virtuoso
? Variable-length with limit VARCHAR(n) VARCHAR(n) VARCHAR(n) VARCHAR(n)
NVARCHAR(n)
VARCHAR(n)
NVARCHAR(n)
VARCHAR[(n or max)]
NVARCHAR[(n or max)]
VARCHAR(n) VARCHAR(n)
CHARACTER VARYING(n)
VARCHAR2(n)
VARCHAR(n) is slated for deprecation
character varying(n)
varchar(n)
TEXT[1] VARCHAR(n)
? Variable-length with limit, max size no limit ? 32765 ? ? 2 GB with (max) or 8000 with the fixed limit 65535 about 2 GB 4000 bytes (32767 bytes if MAX_STRING_SIZE = EXTENDED - Oracle 12G) about 1 GB no limit (enforced by global, default = 1M) ?
? Fixed-length, blank padded string CHAR(n) CHAR(n) CHAR(n) CHAR(n)
NCHAR(n)
CHAR(n)
NCHAR(n)
CHAR(n)
NCHAR(n)
CHAR(n) ? CHAR(n) character(n)
char(n)
N/A CHAR(n)
? Fixed-length, blank padded string, max size no limit ? 32767 ? ? 8000 255 ? 2000 about 1 GB N/A ?

Notes:

  1. uses dynamic typing; allows any type name