Domini elementari
- carattere: singoli caratteri o stringhe, anche di lunghezza variabile
- bit: singoli booleani o stringhe
- numerici, esatti o approssimati
- data, ora, intervalli di tempo
- introdotti in SQL:1999:
- boolean
- BLOB, CLOB (binary/character large object): per grandi immagini e testi
Domini in SQL2: numeri e stringhe
Numerici:
- interi (INTEGER o INT, SMALLINT)
- reali (FLOAT, REAL, DOUBLE PRECISION)
- numeri formattati (DECIMALI(i, j), DEC(i, j), NUMERICI(i, j))
- i, detta precisione, indica il numero di cifre decimali
- j, detta scala, indica il numero di cifre dopo la virgola
Stringhe di caratteri:
- a lunghezza fissa (CHAR(n), CHARACTER(n))
- a lunghezza variabile (VARCHAR(n) o CHAR VARYING(n))
- per default n, il numero massimo di caratteri, รจ 1
Stringhe di bit:
- a lunghezza fissa (BIT(n))
- a lunghezza variabile (BIT VARYING(n))
Domini in SQL2: date e orari
DATE:
- ha dieci posizioni, con componenti YEAR, MONTH e DAY; formato YYYY-MM-DD
TIME:
- ha (almeno) otto posizioni con componenti HOUR, MINUTE e SECOND; formato HH:MM:SS