Overview of SQL datataypes based on SQL 2003 (as it seems most extensive). "x" in column implies it exists also in other SQL versions, or is anticipated by
ADQL.
VOTable column gives likely mapping to VOTable data type.
a "[(P[,S])]" after a datatypeps indicates that a precision (P) and possibly a scale(S) can be provided.
For info on database support this look at
JVO presentation during Victoria 2006 interop. Also various JDBC mapping tables such as
this.
In table stick to predefined data types. SQL 2003 and 99 also various user defined types such as ROW etc.
NB complete matching to other versions of SQL etc.
SQL 2003 |
SQL 92 |
SQL 99 |
ADQL 2.0 |
JDBC type4 |
VOTable 1.2 (beta) |
CHARACTER [(P)] |
o |
o |
o |
CHAR |
char |
CHAR [(P)] |
o |
o |
o |
CHAR |
char |
CHARACTER VARYING[(P)] |
o |
o |
o |
VARCHAR |
char |
CHAR VARYING [(P)] |
o |
o |
o |
VARCHAR |
char |
VARCHAR [(P)] |
o |
o |
o |
VARCHAR |
char |
CHARACTER LARGE OBJECT [(P)]1 |
x |
o |
x |
CLOB |
char (?) |
CHAR LARGE OBJECT [(P)]1 |
x |
o |
x |
CLOB |
char (?) |
CLOB [(P)]1 |
x |
o |
x |
CLOB |
char (?) |
NATIONAL CHARACTER [(P)] |
o |
o |
o |
NCHAR |
char |
NATIONAL CHAR [(P)] |
o |
o |
o |
NCHAR |
char |
NCHAR [(P)] |
o |
o |
o |
NCHAR |
char |
NATIONAL CHARACTER VARYING[(P)] |
o |
o |
o |
NVARCHAR |
char |
NATIONAL CHAR VARYING [(P)] |
o |
o |
o |
NVARCHAR |
char |
NCHAR VARYING [(P)] |
o |
o |
o |
NVARCHAR |
char |
NATIONAL CHARACTER LARGE OBJECT [(P)]1 |
x |
o |
x |
NCLOB |
char (?) |
NCHAR LARGE OBJECT [(P)]1 |
x |
o |
x |
NCLOB |
char (?) |
NCLOB [(P)]1 |
x |
o |
x |
NCLOB |
char (?) |
BINARY LARGE OBJECT [(P)]1 |
x |
o |
x |
BLOB |
x |
BLOB [(P)]1 |
x |
o |
x |
BLOB |
x |
NUMERIC [(P[,S])] |
o |
o |
o |
NUMERIC |
x5 |
DECIMAL [(P[,S])] |
o |
o |
o |
DECIMAL |
x5 |
DEC [(P[,S])] |
o |
o |
x |
DECIMAL |
x5 |
INTEGER |
o |
o |
o |
INTEGER |
int |
INT |
o |
o |
o |
INTEGER |
int |
SMALLINT |
o |
o |
o |
SMALLINT |
short |
BIGINT |
x |
x |
x |
BIGINT |
long |
FLOAT [(P)] |
o |
o |
o |
FLOAT |
double/float |
REAL |
o |
o |
o |
REAL |
float |
DOUBLE PRECISION |
o |
o |
o |
DOUBLE |
double |
BOOLEAN |
x |
o |
x |
BOOLEAN |
boolean |
DATE |
o |
o |
o |
DATE |
x |
TIME [(P)]2 |
o |
o |
o |
TIME |
x |
TIMESTAMP [(P)]2 |
o |
o |
o |
TIMESTAMP |
x |
INTERVAL ... 3 |
o |
o |
o |
x |
x |
x |
BIT [(P)] |
o |
o |
BIT? |
bit? |
x |
BIT VARYING [(P)] |
o |
o |
BIT? |
bit? |
x |
x |
x |
STC |
x |
x |
1 The syntax for sizes of large objects is actually somewhat different from the "[(P)]" applicable to simpler data types.
2 The syntax for sizes of TIME and TIMESTAMP is actually somewhat different from the "[(P)]" applicable to simpler data types.
3 See the
SQL 2003 grammar for precise specification of INTERVAL type.
4 JDBC's java.sql.Types defines many other types that do not appear in any of the SQL standards, but correspond to database type systems.
5 Decimal might be mapped to floats or doubles in a result type, but have different semantics for mathematical operations etc.