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

  • Learning PostgreSQL 11
  • Salahaldin Juba Andrey Volkov
  • 231字
  • 2021-07-02 13:11:38

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, the 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. Atomicity means that each value in the domain is indivisible. For instance, the name attribute domain is not atomic because it can be divided 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 more easy to third-party software and increases your data quality.
主站蜘蛛池模板: 扎赉特旗| 那曲县| 武城县| 永吉县| 新兴县| 隆子县| 从江县| 清镇市| 永年县| 锡林郭勒盟| 八宿县| 馆陶县| 随州市| 东乌珠穆沁旗| 精河县| 盐池县| 丽江市| 临城县| 遂昌县| 孝昌县| 巴中市| 叙永县| 张家界市| 和田市| 宾川县| 衡阳县| 盐亭县| 兴安县| 临夏县| 宾阳县| 泗洪县| 金门县| 焉耆| 油尖旺区| 额尔古纳市| 洛南县| 宜昌市| 繁峙县| 绵竹市| 柞水县| 稷山县|