SQL: multi valued attributes

后端 未结 4 1194
庸人自扰
庸人自扰 2020-12-31 04:21

I created a table that contains information about a company. One attribute is their telephone number. A company can have many telephone numbers.

How do I create mul

4条回答
  •  我在风中等你
    2020-12-31 05:16

    In addition to Oleg and Sergey's answers, a third option might be to create multiple phone fields on the company table - for example, as SwitchboardPhone and FaxNumber for the main switchboard and the fax line, respectively.

    This type of solution is generally regarded as a form of denormalisation, and is generally only suitable where there is a small number of multiple options, each with a clearly defined role.

    So, for example, this is quite a common way to represent landline and mobile/cellphone numbers for a contact list table, but would be thoroughly unsuitable for a list of all phone extensions within a company.

提交回复
热议问题