(Data) Type - (Datatype|Type of data)

About

Variables, parameters, and function may be typed (static typing) and return values that are typed (as do a database column).

The type of a variable or expression defines the characteristics of the values it may take on, such as:

  • their size (number of bits or number of elements),
  • how they are represented internally,
  • the intrinsic operations that can be performed on them,
  • and the methods associated with them.

In any program there are variables that share the same representation but signify very different concepts.

For instance,

  • An int could be used to represent:
    • a loop index,
    • a timestamp,
    • a file descriptor,
    • or a month;
  • A float64 could represent:
    • a velocity in meters per second
    • or a temperature in one of several scales;
  • and a string could represent:
    • a password
    • or the name of a color.

A type restricts the possible values to which:

at run time or compile time

High-level languages are characterized by the fact that objects of programs, for example variables and functions, are classified according to their type.

Data type define the class of data that can be stored in a variable.

It defines what sort of value is (or not) accepted as input into a column or or a field.

Each value manipulated as a datatype:

  • in an application (such as a database)
  • or in a development language.

The datatype of a value associates a fixed set of properties with the value. These properties cause the software to treat values of one datatype differently from values of another. For example, you can add values of NUMBER datatype, but not values of RAW datatype.

A type gives hints on the set of operations that the data type will support.

See also:

  • wiki/Type_system: a type system is a collection of rules that assign a data type to various constructs composing a computer program, such as variables, expressions, functions or modules. Typing is concerned with assigning a type to any object.
  • Data Type - Duck typing determines the suitability of an object by the presence of methods and properties, rather than the actual type of the object as in typing.

For the SQL specification, a data type is a set of representable values. Every data value belongs to some data type. Every data type is either predefined, constructed, or user-defined. Every data type includes a special value, called the null value.

Types enable developers to use highly-productive development tools and practices like:

Type inference allows a few type annotations to make a big difference to the static verification of your code.

Type System let you define interfaces between software components and gain insights into the behavior of existing libraries.

Did you know ?

In typography, a type is a piece that represent a symbol

Named Type

A type declaration defines a new named type that has the same underlying type as an existing type.

Controle the Domain of values

These datatypes define the domain of values that each column can contain or each argument can have. For example, DATE columns cannot accept the value February 29 (except for a leap year) or the values 2 or 'SHOE'.

Each value subsequently placed in a column assumes the datatype of the column. For example, if you insert '01-JAN-98' into a DATE column, then database treats the '01-JAN-98' character string as a DATE value after verifying that it translates to a valid date.

Variable Actions defined their type

When you need to:

Type

A primitive data type differs from a class data type in that instances of a primitive type are identified only by their value. (All instances of a primitive type with the same value are considered to be equal instances)

Primitive

The first type available in a language are called the primitive (character, integer, …) (scalar variable)

They are called primitive because they have no substructure.

Complex

All complex data type are based on a class concept. They are complex because they shows a structure. See Data Type - Complex Data Type

Documentation / Reference

Task Runner