Specify the database domain

      No Comments on Specify the database domain

Enter data and domain name
When you enter data into an online form of any kind – whether it’s just your name and email, or a complete work application – your input storage database behind backstage. That database evaluates your items based on a set of criteria. For example, if you enter a zip code, the database will find five numbers or for the complete US zip code: the five numbers followed by a hyphen and then the four numbers. If you enter your name in the zip code field, the database may complain.

That’s because the database is checking your entry for the domain specified for the zip code field. A domain is basically a data type that can include optional restrictions.

Understand a database domain
To understand a database domain, let’s look at several other aspects of databases:

A database schema defines a set of attributes, also called columns or fields. For example, if you have an Employee Contact table, it can include attributes for FirstName, LastName, JobTitle, StreetAddress, City, State, ZipCode, PhoneNumber and Email.
Each attribute has a domain that defines the allowed values. This can include data types, lengths, values ​​and other details.
For example, the domain name for an attribute ZipCode can specify a numeric data type, such as an integer, usually called INT or INTEGER, depending on the database. Or a database designer might choose to define it instead of a character, often called CHAR. Attributes can be specified further to require specific lengths or allow blank or undefined values ​​to be allowed.

When you gather all the elements that define a domain, you end up with a custom data type, also known as a user-defined data type, or a UDT.

About the integrity of the domain
The allowed values ​​of the attribute create domain integrity, ensuring that all data in the field contains valid values.

Domain integrity is determined by:

Data types, such as integers, characters, or decimals.
Allowable length of data.
Scope, define upper and lower boundaries.
Any constraints, or restrictions on allowed values. For example, a U.S. zip code field may execute a complete ZIP + 4 code or a full nine-digit code.
Type that supports NULL or whether an attribute can have an NULL value is unknown or not.
Default value, if available.
Date format, if possible (for example, dd / mm / yy or mm / dd / yyyy).
Create a domain name
For databases using SQL (Structured Query Language) or SQL flavors, use the CREATE DOMAIN SQL command.

For example, the executable statement here creates a ZipCode attribute of the CHAR data type with five characters. A NULL, or an unspecified value, is not allowed. The range of data must be between 00 0000 and 99999. That mode creates a ZipCode attribute of the CHAR data type with five characters. A NULL, or an unspecified value, is not allowed. The range of data must be between 00 00000 and 99999.

Leave a Reply

Your email address will not be published. Required fields are marked *