Форум » Ремонт и сервис » How to Choose a Primary Key in a Database » Ответить

How to Choose a Primary Key in a Database

jonsmaradon: A primary key is a column in a relational database that's used to uniquely identify each record in a table. When selecting a primary key, you'll need to choose a column that contains unique values for all rows. Every single row must have a value in the primary key column, and the values must not change. If you can't find a natural primary key that fits all of the rules, you could create a surrogate key. A primary key also called a primary keyword, is a column in a relational database table that's distinctive for each record. It's a unique identifier, such as a driver's license number, telephone number with area code, or vehicle identification number (VIN). A relational database must have only one primary key in SQL. Every row of data must have a primary key value and none of the rows can be null. The choice of a primary key in a relational database often depends on the preference of the administrator. It's possible to change the primary key for a given database when the specific needs of the users change. For example, the people in a town might be uniquely identified according to their driver's license numbers in one application, but in another situation, it might be more convenient to identify them according to their telephone numbers. A primary key serves a special place inside the data table of a relational database management system (RDBMS), such as a SQL server or an Oracle database. Every entity in a data model should have a primary key, which should be based on a single attribute or a group of attributes.

Ответов - 0



полная версия страницы