SQL - (Data|Column) Type

> (Data|State) Management and Processing > (Data Type|Data Structure) > (Relation|Table) - Tabular data > Structured Query Language (SQL)

1 - About

The latest version of the ANSI/ISO SQL standard specifies the following data types

Advertising

3 - Type

3.1 - Built-in

Standard built-in types
SQL92 CHARACTER, CHARACTER VARYING, BIT, BIT VARYING, NUMERIC, DECIMAL, INTEGER, SMALLINT, FLOAT, REAL, DOUBLE PRECISION, DATE, TIME, TIMESTAMP, and INTERVAL. See Sql92 doc
SQL99 BOOLEAN: Boolean (true or false) value
BLOB: Binary large object
CLOB: Character large object
SQL:2003 XML: XML object

3.2 - User defined

3.2.1 - Structured type

CREATE TYPE PLANE_POINT
AS (X FLOAT, Y FLOAT) NOT FINAL

3.2.2 - DISTINCT type

User-defined type based on a built-in type; for example:

CREATE TYPE MONEY
AS NUMERIC(10,2) FINAL
Advertising

3.3 - Constructed types

New types based on a given base type:

3.3.1 - REF(structured-type)

Pointer that persistently denotes an instance of a structured type that resides in the database

3.3.2 - base-type ARRAY[n]

Array of n base-type elements

3.3.3 - Locators

Entities that are logical pointers to data that resides on the database server. A locator exists in the client computer and is a transient, logical pointer to data on the server. A locator typically refers to data that is too large to materialize on the client, such as images or audio. (Materialized views are query results that have been stored or “materialized” in advance as schema objects.) There are operators defined at the SQL level to retrieve randomly accessed pieces of the data denoted by the locator:

  • LOCATOR(structured-type): Locator to a structured instance in the server
  • LOCATOR(array): Locator to an array in the server
  • LOCATOR(blob): Locator to a binary large object in the server
  • LOCATOR(clob): Locator to a character large object in the server

Type for managing data external to the data source. Datalink values are part of SQL MED (Management of External Data), a part of the SQL ANSI/ISO standard specification.

5 - Documentation / Reference

Advertising