官术网_书友最值得收藏!

Attribute

Each attribute has a name and a domain, and the name should be distinct within the relation. The domain defines the possible set of values that the attribute can have. One way to define the domain is to define the data type and a constraint on this data type. For example, hourly wage should be a positive real number and bigger than five if we assume that the minimum hourly wage is five dollars. The domain could be continuous, such as salary, which is any positive real number, or discrete, such as gender.

The formal relational model puts a constraint on the domain: the value should be atomic. Atomic means that each value in the domain is inpisible. For instance, the name attribute domain is not atomic because it can be pided into first name and last name. Some examples of domains are as follows:

  • Phone number: Numeric text with a certain length.
  • Country code: Defined by ISO 3166 as a list of two letter codes (ISO alpha-2) and three letter codes (ISO alpha-3). The country codes for Germany are DE and DEU for alpha-2 and alpha-3 respectively.

In real-life applications, it is better to use ISO and international standards for lookup tables such as country and currency. This enables you to expose your data much easily for third-party software and increases your data quality.

主站蜘蛛池模板: 临湘市| 罗城| 丹寨县| 龙海市| 临夏县| 西华县| 南澳县| 敦煌市| 沧州市| 井陉县| 绥棱县| 黄梅县| 炎陵县| 磴口县| 潮安县| 驻马店市| 和顺县| 华阴市| 辽阳市| 米易县| 云梦县| 米脂县| 图们市| 临湘市| 扶风县| 和林格尔县| 亚东县| 梨树县| 玉树县| 乌兰察布市| 扎鲁特旗| 容城县| 山西省| 如东县| 漳浦县| 阿勒泰市| 那曲县| 浪卡子县| 象州县| 体育| 桂林市|