Data Types

Recall from “Tables, Columns, and Rows” in Chapter 2 that a column’s domain constrains the values that can be stored in the column. You can use a column’s data type for this purpose. A data type has these characteristics:

  • Each column in a table has a single data type.

  • A data type falls into one of categories listed in Table 3.4 (covered in the next six sections).

  • The data type determines a column’s allowable values and the operations it supports. An integer data type, for example, can represent any whole number between certain DBMS-defined limits and supports the usual arithmetic operations: addition, subtraction, multiplication, and division (among others). But an integer can’t represent a nonnumeric value such as ’schadenfreude’ and ...

Get SQL: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.