Domain Example In Database
Create table student sid char 9 primary key name varchar 30 cpi cpi data.
Domain example in database. Reference tables are formally related to other tables in a database by the use of foreign keys. Columns in table have a unique name often referred as attributes in dbms. This gender column might be declared as a smallint data type and allowed to have a value between 0 and 120. Every time cpi data will check the constraint when you add data in student table.
Create domain cpi data as real check value 0 and value 10. In a normalized data model the reference domain is typically specified in a reference table. A domain is a unique set of values permitted for an attribute in a table. In other words an area code plus a seven digit phone number.
For example a database table that has information about people with one record per person might have an age column. Now cpi data domain is create so we can use this domain anywhere in any table of database as below. In most cases large companies will have more granular data do. Insert into student values 201501408 raj.
They can be broad like customer or more granular like customer name. The rule for determining the domain boundary may be as simple as a data type with a list of possible values. See below for some examples one goal of database developers is to provide data integrity part of which means insuring that the value entered in each field of a table is consistent with its attribute domain. Before you design the data type and input format for an attribute you have to.
Another more complex example of a data domain would be a field for an employee s phone number. Following the previous example a gender reference table would have exactly two records one per allowed value excluding null. In the us the data domain in this field would have to be limited to numbers only along with a maximum length of 10 characters. If you re not familiar with the concept domain.
For example a domain of month of year can accept january february december as possible values a domain of integers can accept whole numbers that are negative positive and zero. Sometimes we can devise a validation rule to separate good from bad data.