In relational database design, a unique key or primary key is a candidate key to uniquely identify each row in a table. A unique key or primary key comprises a single column or set of columns. No two distinct rows in a table can have the same value (or combination of values in those columns. Depending on its design, a table may have arbitrarily many unique keys but at most one primary key.

PropertyValue
dbpprop:abstract
  • In relational database design, a unique key or primary key is a candidate key to uniquely identify each row in a table. A unique key or primary key comprises a single column or set of columns. No two distinct rows in a table can have the same value (or combination of values in those columns. Depending on its design, a table may have arbitrarily many unique keys but at most one primary key. A unique key must uniquely identify all possible rows that exist in a table and not only the currently existing rows. Examples of unique keys are Social Security numbers (associated with a specific person or ISBNs (associated with a specific book. Telephone books and dictionaries cannot use names, words, or Dewey Decimal system numbers as candidate keys because they do not uniquely identify telephone numbers or words. A primary key is a special case of unique keys. The major difference is that for unique keys the implicit NOT NULL constraint is not automatically enforced, while for primary keys it is enforced. Thus, the values in unique key columns may or may not be NULL. Another difference is that primary keys must be defined using another syntax. The relational model, as expressed through relational calculus and relational algebra, does not distinguish between primary keys and other kinds of keys. Primary keys were added to the SQL standard mainly as a convenience to the application programmer. Unique keys as well as primary keys can be referenced by foreign keys.
  • Ein Schlüssel dient in einer Relationalen Datenbank dazu, die Tupel einer Relation eindeutig zu identifizieren. Anschaulich kann man sich eine Relation als Tabelle vorstellen. Ein Schlüssel für eine solche Tabelle ist dann eine Gruppe von Spalten, die so ausgewählt wird, dass jede Zeile in dieser Gruppe eine einmalige Wertekombination hat.
  • Primární klíč je pole nebo kombinace polí, jednoznačně identifikující každý záznam v databázové tabulce. Žádné pole, které je součástí primárního klíče, nesmí obsahovat hodnotu NULL. Každá tabulka má mít definovaný právě jeden primární klíč (entitní integrita). Primární klíč má dvě základní vlastnosti: jedinečnost v rámci tabulky a ne-NULL-ovou hodnotu. Databázový systém by měl být navržen a udržován tak, aby se primární klíč založeného záznamu nikdy nemusel měnit. Typickým příkladem primárního klíče je například katalogové číslo u výrobků, identifikační číslo v seznamu podniků apod. Pokud u záznamu neexistuje žádný přirozený primární klíč, nebo je takový primární klíč příliš složitý, používá se obvykle jako primární klíč číslo, které záznamu přidělí automaticky sama databáze. Takové číslo může být pořadové číslo nebo pseudonáhodné číslo. Většinou se pak nazývá ID.
  • En el diseño de bases de datos relacionales, se llama clave primaria a un campo o a una combinación de campos que identifica de forma única a cada fila de una tabla. Una clave primaria comprende de esta manera una columna o conjunto de columnas. No pueden haber dos filas en una tabla que tengan la misma clave primaria. Una clave primaria debe identificar unívocamente a todas las posibles filas de una tabla y no solo a las filas que se encuentran en un momento determinado. Ejemplos de claves primarias son DNI (asociado a una persona o ISBN (asociado a un libro. Las guias telefónicas y diccionarios no pueden usar nombres o palabras o números del sistema decimal de Dewey como claves candidatas, porque identifican unívocamente números de teléfono o palabras. Una clave primaria es un caso especial de clave única. La mayor diferencia es que para claves únicas, no se impone automáticamente la restricción implícita NOT NULL, mientras que para claves primarias, sí. Así, los valores en columnas de clave única pueden o no ser NULL. Otra diferencia es que las claves primarias deben definirse por medio de otra sintaxis. El modelo relacional, según se lo expresa mediante cálculo relacional y álgebra relacional, no distingue entre clave primaria y otros tipos de claves. Las claves primarias fueron agregadas al estándar SQL principalmente para conveniencia del programador. Tanto claves únicas como claves primarias pueden referenciarse con claves foráneas.
  • Dans une base de données relationnelle, une clé primaire est une contrainte d'unicité qui permet d'identifier de manière unique un enregistrement dans une table. Une clé primaire peut être composée d'un ou de plusieurs champs de la table. Deux lignes distinctes de la table ne peuvent pas avoir les mêmes valeurs pour les champs définis au niveau de la clé primaire. Il est possible de définir pour une même table plusieurs contraintes d'unicité, mais au plus une seule clé primaire. La clé primaire d'une table doit se placer sur des champs qui permettent d'identifier chaque ligne de la table. Il peut donc sembler intéressant de placer une clé primaire sur un numéro de sécurité sociale par exemple, mais on préfèrera utiliser une clé primaire complètement indépendante des données métier, afin de s'assurer que le champ est toujours rempli (un étranger ou un enfant peuvent ne pas avoir de numéro de sécurité sociale) et n'évolue pas dans le temps. Toutes les bases de données proposent des mécanismes prenant en charge une numérotation utilisable pour les clés primaires. Il n'est pas nécessaire de définir un index sur les colonnes définissant la clé primaire, car un index implicite est associé à la clé primaire. L'ensemble constitué d'une clé primaire et d'une clé étrangère sert à établir des relations entre tables.
  • 主キー(しゅきー、primary key)とは、リレーショナルデータベースにおいて、組(レコード)の識別子として利用するのにもっとも好ましいものとして、リレーション(テーブル)毎にただ一つ設計者により選択・定義された候補キーをいう。つまり、リレーションに格納されたレコードを一意に識別するための属性(列、アトリビュート)またはその集合のうち、そのために通常利用されるべき特定の一つをいう。 リレーショナルデータベース管理システム (RDBMS) やミドルウェア、アプリケーションなどでレコードの識別子が必要な場合、主キーがそのために使われることが多い。ただ、そうしなければならない必然性はなく、他の候補キーを使っても良い。したがって、主キーの理論上の意義は大きくないが、実務上は、そのわかりやすさなどから広く使われている概念である。 ただし、主キーにはNULLの存在が許されないが、候補キーには許されるという差があるとする立場もある。(レコードの追加、更新時の制約として主キーを考える場合、一意性制約にNOT NULL制約を加えたものが主キー制約であると考えることができる。) リレーションに存在する候補キーが一つであるときは、その候補キーが当然に主キーとなる。 なお、主キーでない候補キーは代理キー(alternate key)という。
  • Primaire sleutel is in database technologie de benaming voor een variabele of een combinatie van variabelen die voldoet aan volgende eisen : De waarde van de variabele (of van de combinatie van variabelen) is uniek binnen de tabel en bepaalt dus eenduidig de record waarin hij voorkomt. De variabele (of de combinatie van variabelen) is overal ingevuld en kan dus niet leeg zijn De combinatie van variabelen is minimaal : door het laten vallen van één van de variabelen wordt de record niet langer meer eenduidig bepaald Wanneer gerelateerde tabellen verwijzen naar de tabel waarin de variabele (of combinatie) van variabelen voorkomen, wordt deze gebruikt om een relatie tussen tabellen tot stand te brengen. Daar voorwaarde 1 en 2 de voorwaarden zijn om te kunnen spreken van een kandidaatsleutel, kan een primaire sleutel ook worden omschreven als : De kandidaatsleutel die wordt gebruikt als primaire identificatiemethode van een record binnen een tabel.
  • En nøkkel i en database er attributter/data som kan peke til eller fastsette andre data. Nøkkelbegrepet brukes i hovedsak i sammenheng med relasjonsdatabaser. I tillegg til at nøkler tjener som referanser er de viktige integritetsregler, regler som begrenser hvilke tilstander som er lovlige i databasen. Nøklene stiller krav til verdiene i databasen, og databasehåndteringssystemet må kontrollere at alle nøkler er oppfylt hver gang en relevant endring skjer.
  • Klucz główny – pojęcie z zakresu teorii relacyjnych baz danych. Oznacza wybrany zestaw atrybutów encji, jednoznacznie identyfikujący każdą krotkę tej relacji. Kluczem głównym może być dowolny klucz potencjalny, ale często stosuje się rozwiązanie polegające na utworzeniu specjalnego atrybutu, którego wartości domyślne pobierane są z sekwencji tak, aby zapewnić unikalność klucza.
  • Chaves primárias em inglês Primary Keys ou PK sob o ponto de vista de um banco de dados relacional, referem-se às tuplas conjuntos de um ou mais campos, cujos valores, considerando a combinação de valores de todos os campos da tupla, nunca se repetem e que podem ser usadas como um índice para os demais campos da tabela do banco de dados. Em chaves primárias, não pode haver valores nulos nem repetição de tuplas. Simplificando, quando a chave primária é simples, ou seja, é formada por um único campo da tabela, esse campo não pode ter dois ou mais registros de mesmo valor, e também não pode conter nenhum registro nulo. Se a chave primária é composta, ou seja, formada por mais de um campo, os valores de cada campo podem se repetir, mas não a combinação desses valores. Exemplo: a tabela 'Livros_Autores' tem como chave primária cod_livro, cod_autor. Podem existir nessa tabela os registros: Mas não podem existir dois registros 5, 9. Ao criarmos uma chave primária, criamos automaticamente um índice do tipo aglomerado CLUSTERED. Este é o tipo criado por padrão, mas caso já exista um índice desse tipo em sua tabela, então é necessário ser criado um índice do tipo não-aglomerado NONCLUSTERED. Podemos inserir uma chave primária durante ou após a criação da tabela. Com a tabela já criada, o campo que escolhermos para ser a chave primária deve ter a opção NOT NULL adicionada. Para inserirmos durante a criação usamos a seguinte sintaxe: CREATE TABLE nome_tabela Codigo int CONSTRAINT nome_constraint PRIMARY KEY CLUSTERED, Nome nvarchar17 Nessa estrutura escolhemos um índice do tipo CLUSTERED e resolvemos nomear com algum nome desejado a constraint de primary key. O índice poderia ser do tipo Nonclustered e poderíamos deixar o próprio SQL Server nomear a constraint, da seguinte forma: CREATE TABLE nome_tabela Codigo int PRIMARY KEY NONCLUSTERED, Nome nvarchar17 Além disso, pode-se definir a chave primária após a declaração dos campos, como segue: CREATE TABLE nome_tabela campo1 <tipo> NOT NULL, campo2 <tipo> NOT NULL, campoX <tipo>, PRIMARY KEY campo1, campo2 Na definição de chave primária, usamos o comando ALTER TABLE para inserirmos e excluirmos uma primary key. As sintaxes respectivamente são: ALTER TABLE nome_tabela ADD CONSTRAINT nome_constraint PRIMARY KEY NONCLUSTEREDnome_campo ALTER TABLE nome_tabela DROP CONSTRAINT nome_constraint Uma chave candidata consiste em um atributo ou grupo de atributos cujo valor identifica unicamente cada tupla em uma relação e para o qual nenhum dos atributos pode ser removido sem destruir a identificação única.
  • Перви́чный ключ — понятие теории реляционных баз данных, минимальное множество атрибутов, являющееся подмножеством заголовка данного отношения, составное значение которых уникально определяет кортеж отношения. На практике термин первичный ключ обозначает поле (столбец) или группу полей таблицы базы данных, значение которого (или комбинация значений которых) используется в качестве уникального идентификатора записи (строки) этой таблицы.
  • Primärnyckel (Primary key) är en eller flera fält (kolumner) i en databastabell vars värde är unika identifierare för varje rad. En primärnyckel kan inte tillåtas att vara tom och måste alltid ha ett unikt index. En primärnyckel kan användas för att relatera en tabell till relations nycklar (foreign keys) i andra tabeller inom en Relationsdatabas.
  • 主键(Unique Key 或 Primary Key),又称主码。数据库表中对储存数据对象予以唯一和完整标识的数据列或属性的组合。一个数据库表只能有一个主键,且主键的取值不能缺失,即不能为空值(Null)。 从技术的角度来看,Primary Key和Unique Key有很多相似之处。但还是有以下区别: 一、作为Primary Key的域/域组不能为null。而Unique Key可以。 二、在一个表中只能有一个Primary Key,而多个Unique Key可以同时存在。 更大的区别在逻辑设计上。Primary Key一般在逻辑设计中用作记录标识,这也是设置 Primary Key的本来用意。而Unique Key只是为了保证域/域组的唯一性。
dbpprop:date
  • August 2009
dbpprop:hasPhotoCollection
dbpprop:wikiPageUsesTemplate
rdfs:comment
  • In relational database design, a unique key or primary key is a candidate key to uniquely identify each row in a table. A unique key or primary key comprises a single column or set of columns. No two distinct rows in a table can have the same value (or combination of values in those columns. Depending on its design, a table may have arbitrarily many unique keys but at most one primary key.
  • Ein Schlüssel dient in einer Relationalen Datenbank dazu, die Tupel einer Relation eindeutig zu identifizieren. Anschaulich kann man sich eine Relation als Tabelle vorstellen. Ein Schlüssel für eine solche Tabelle ist dann eine Gruppe von Spalten, die so ausgewählt wird, dass jede Zeile in dieser Gruppe eine einmalige Wertekombination hat.
  • Primární klíč je pole nebo kombinace polí, jednoznačně identifikující každý záznam v databázové tabulce. Žádné pole, které je součástí primárního klíče, nesmí obsahovat hodnotu NULL. Každá tabulka má mít definovaný právě jeden primární klíč (entitní integrita). Primární klíč má dvě základní vlastnosti: jedinečnost v rámci tabulky a ne-NULL-ovou hodnotu.
  • En el diseño de bases de datos relacionales, se llama clave primaria a un campo o a una combinación de campos que identifica de forma única a cada fila de una tabla. Una clave primaria comprende de esta manera una columna o conjunto de columnas. No pueden haber dos filas en una tabla que tengan la misma clave primaria. Una clave primaria debe identificar unívocamente a todas las posibles filas de una tabla y no solo a las filas que se encuentran en un momento determinado.
  • Dans une base de données relationnelle, une clé primaire est une contrainte d'unicité qui permet d'identifier de manière unique un enregistrement dans une table. Une clé primaire peut être composée d'un ou de plusieurs champs de la table. Deux lignes distinctes de la table ne peuvent pas avoir les mêmes valeurs pour les champs définis au niveau de la clé primaire. Il est possible de définir pour une même table plusieurs contraintes d'unicité, mais au plus une seule clé primaire.
  • Primaire sleutel is in database technologie de benaming voor een variabele of een combinatie van variabelen die voldoet aan volgende eisen : De waarde van de variabele (of van de combinatie van variabelen) is uniek binnen de tabel en bepaalt dus eenduidig de record waarin hij voorkomt.
  • En nøkkel i en database er attributter/data som kan peke til eller fastsette andre data. Nøkkelbegrepet brukes i hovedsak i sammenheng med relasjonsdatabaser. I tillegg til at nøkler tjener som referanser er de viktige integritetsregler, regler som begrenser hvilke tilstander som er lovlige i databasen. Nøklene stiller krav til verdiene i databasen, og databasehåndteringssystemet må kontrollere at alle nøkler er oppfylt hver gang en relevant endring skjer.
  • Klucz główny – pojęcie z zakresu teorii relacyjnych baz danych. Oznacza wybrany zestaw atrybutów encji, jednoznacznie identyfikujący każdą krotkę tej relacji. Kluczem głównym może być dowolny klucz potencjalny, ale często stosuje się rozwiązanie polegające na utworzeniu specjalnego atrybutu, którego wartości domyślne pobierane są z sekwencji tak, aby zapewnić unikalność klucza.
  • Chaves primárias em inglês Primary Keys ou PK sob o ponto de vista de um banco de dados relacional, referem-se às tuplas conjuntos de um ou mais campos, cujos valores, considerando a combinação de valores de todos os campos da tupla, nunca se repetem e que podem ser usadas como um índice para os demais campos da tabela do banco de dados. Em chaves primárias, não pode haver valores nulos nem repetição de tuplas.
  • Перви́чный ключ — понятие теории реляционных баз данных, минимальное множество атрибутов, являющееся подмножеством заголовка данного отношения, составное значение которых уникально определяет кортеж отношения.
  • Primärnyckel (Primary key) är en eller flera fält (kolumner) i en databastabell vars värde är unika identifierare för varje rad. En primärnyckel kan inte tillåtas att vara tom och måste alltid ha ett unikt index. En primärnyckel kan användas för att relatera en tabell till relations nycklar (foreign keys) i andra tabeller inom en Relationsdatabas.
rdfs:label
  • Unique key
  • Schlüssel (Datenbank)
  • Primární klíč
  • Clave primaria
  • Clé primaire
  • 主キー
  • Primaire sleutel
  • Nøkkel (database)
  • Klucz główny
  • Chave primária
  • Первичный ключ
  • Primärnyckel
  • 主键
owl:sameAs
skos:subject
foaf:page
is dbpprop:disambiguates of
is dbpprop:redirect of