Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [candidate-key]

A candidate key of a relational table is a set of columns whose subrow values are unique (a unique key, aka superkey) that doesn't contain a smaller such set. One can be chosen primary key; each other is then an alternate key. (An SQL PRIMARY KEY or UNIQUE NOT NULL declaration declares a superkey. It is a candidate key if no smaller one is declared within it.)

0
votes
2answers
62 views

What are the disadvantages of using surrogate keys? [closed]

I am using MS SQL Server but in general database design I want to know what problems can arise when every row in a database has its auto generated surrogate key value. I know some advantages, for ...
5
votes
2answers
102 views

Does the concept of candidate key exist only in theory?

I know the concept of candidate key in RDBMS theory, but do candidate keys really exist in actual SQL engines? I mean is there any way to designate a particular column or set of columns as a candidate ...
1
vote
2answers
46 views

Defining a primary key: Customer numbers are unique only within a country but may be duplicated across different countries

I am facing the following problem: I have a table with customer information like the customer number, i.e. customerID set up as the primary key, and, besides a number of other data, also a country ...
2
votes
1answer
84 views

What is the meaning of “minimal key”?

In the definition, it says minimal key is a minimal set of attributes needed to identify the table. Does the "minimal" part mean "minimal number of attributes" or "cannot be eliminated"? For example: ...
6
votes
3answers
1k views

When should a primary key be meaningful?

Excuse the looseness of any definitions here, but I am trying to explore a simple concept. A Primary Key uniquely identifies a row. There are possibly other columns in a table with unique values, so ...
19
votes
4answers
93k views

What is the difference between Primary key and Super key in DBMS

I am new to DBMSs and I am still learning the theory. I am getting really confused with this key business and after googling I have narrowed it down to just 2 keys I don't get (primary and super key)....
2
votes
2answers
113 views

Composite primary key plus a separate (surrogate) id column for foreign key references

I am trying to build a database about locations like so: Country → Region → Town Countries will be populated with a list of pre-defined worldwide countries, regions & towns are input by users. ...