SQL Database Design » 8. User-Defined Types

8. User-Defined Types

Table of Contents

There are several ways to specify user-defined types: domains, distinct types, enumerated types, and object-relational types. User-defined types give you the ability to reuse types as if they were inbuilt. Repeating the type definitions on every column is redundant. User-defined types can be placeholders for standard SQL types that your DBMS is missing. Should you ever port to another DBMS or the latest release of your current DBMS now supports the missing keyword, all you have to do delete the user-defined type. In the opposite direction, you just have to add the respective type declaration.

There are two prominent examples for user-defined types: pseudo booleans and one-byte integers (on DBMSs that don't have them). For boolean domains, refer to the boolean section. For one-byte integer domains, refer to the integral types section.

Last updated: 2010-10-13