Questions tagged [candidate-key]

A key is a set of attributes that is irreducibly unique and non-nullable within a table. Irreducible means that all the attributes of the key are necessary to guarantee uniqueness - remove any one attribute and the uniqueness property would be lost. A key may consist of zero, one or more attributes and a relational table (relation variable) must have at least one key and may have more than one.

A key is a set of attributes that is irreducibly unique and non-nullable within a table. Irreducible means that all the attributes of the key are necessary to guarantee uniqueness - remove any one attribute and the uniqueness property would be lost. A key may consist of zero, one or more attributes and a relational table (relation variable) must have at least one key and may have more than one.

97 questions
0
votes
0 answers

Code about doctor relation, how to find candidate keys

For my homework I have to develop the sql code for the chart in the picture but for the doctor relation how can I show candidate keys? is there a special way of declaring? CREATE TABLE "Doctor" ( "DoctorID" INTEGER NOT NULL, "Superviosr" …
Sina Cengiz
  • 136
  • 1
  • 8
0
votes
0 answers

Candidate Key in Normalization

Relation R: [A,B,C,D,E,F] FD1: (A,B) - C,F FD2: (C,D) - E FD3: (D,E) - B Is (x,y) the candidate key here? if not, what is?
0
votes
1 answer

How to determine keys from functional dependencies

I'm trying to find the keys for the relation R = ABCDE, with functional dependencies AB->C, C->D, C->E, D->A, E->B I know how to find the keys when on the right side of the dependencies there are some attributes missing. But here all attributes…
0
votes
1 answer

What is the specific step to identify Primary key in first normal form

I am very confused about how to identify the primary key in the first normal form In the first example: I can understand the reason that SR_ID and Cus_No are the primary keys. But why Mngr_ID is not a primary key? Why Mngr_ID is depended on SR_ID…
0
votes
1 answer

SQL statement to prove that a candidate key constraint holds in a R(ABCD)

How do I write a SQL statement that proves the candidate key ACD holds given a relation with attributes ABCD and the functional dependency A → B ? I know there's something similar here: SQL statement to prove that A->B in a R(ABCD), but can't…
User1998
  • 3
  • 1
0
votes
0 answers

In BCNF definition, why is "Superkey" given , instead of "minimal Superkey"?

In wikipedia BCNF definition is as follows A relational schema R is in Boyce–Codd normal form if and only if for every one of its dependencies X → Y, at least one of the following conditions hold: X → Y is a trivial functional dependency (Y ⊆ X) X…
0
votes
2 answers

Microsoft T-SQL does not support more than one Primary Key; Suggested Workarounds?

I was reading a brilliant response provided by PerformanceDBA to this SQL Question. In PerformanceDBA 'Full Example', tables 'user' and 'sport' show two PRIMARY KEY s per table. Note; should you look carefully at PerformanceDBA response, you will…
0
votes
1 answer

Is there another candidate key? If so, what is it?

Q. It is known that for R(A,B,C,D,E): R has exactly 5 superkeys. ABC is a candidate key. D is a non-prime attribute. ABE and ACE are not superkeys. Is there another candidate key? If so, what is it? Edit: The question of the problem is to…
0
votes
1 answer

Finding all possible candidate keys from a set of superkeys?

Write a program that can input from a set of superkeys and output all possible candidate keys from the input to an output file (named "candidate-keys"). The superkeys of one example look as follows: ABCF CDF ACDF BCDF ABCDF ABCEF CDEF …
Mary
  • 1
0
votes
0 answers

Maximum number of candidate keys may have

I am having troubles when I trying to solve this question. Can someone help me? Consider the relation schema R=(A, B, C, D) with an unknown set of functional dependencies: What is the maximum number of (candidate) keys that R may have? Design a set…
0
votes
1 answer

A primary key with more than 3 attributes

Consider a relation that depicts a tutorial room booking in a university. Each faculty assigns a person to handle the booking for all tutorial classes for that faculty. The person’s email address is given to the university’s booking system as a…
Gemi Kong
  • 3
  • 1
0
votes
2 answers

Can a table have two columns which could act as primary key

In accordance to the third normal form, we need to avoid dependencies on no key attribute. So if i have a database of users User(username varchar, full_name varchar, country varchar, SSN varchar, UID varchar) And for every user I have his username,…
Eli Braginskiy
  • 2,867
  • 5
  • 31
  • 46
0
votes
1 answer

Algorithm to find Candidate key without Functional Dependencies

Given a table with dozens of columns, many thousands of rows and no known functional dependencies between the columns, is there any algorithm to automatically find a candidate key for that table that is faster or more efficient than this: Check if…
Marco
  • 313
  • 1
  • 2
  • 11
0
votes
2 answers

What is the best practice creating Primary / Unique ID in a RDBMS table when both Candidate & Composite Key Options are possible?

Scenario : - There are two departments namely 'Software' & 'Hardware'. - They have divisions like 'Cobol', 'Fortran', 'Pascal', 'QBasic' in Software department. - And 'RAM', 'HardDisk', 'Monitor', 'CPU' in Hardware department. - Below are the…
0
votes
1 answer

Functional Dependencies and Candidate key

Suppose we have functional dependencies B->A, A->C defined on a relation R(A,B,C). Here B->AC (from given functional dependencies), So is B candidate key? I read in textbooks that if a particular attribute is able to uniquely identify all…
Zephyr
  • 1,521
  • 3
  • 22
  • 42