How to find candidate keys here in DBMS?

  • Comp Sci
  • Thread starter shivajikobardan
  • Start date
In summary, the given relation has a primary key of Sname and Sno, with functional dependencies of Sno,Pno -> Qty, Sname,Pno -> Qty, Sno -> Sname, and Sname->Sno. To find the other primary key, you can use a candidate key calculator. However, there may still be some uncertainty due to missing information.
  • #1
shivajikobardan
674
54
Homework Statement
find candidate keys
Relevant Equations
Normalization in database
Consider a relation given below SP(Sno,Sname,Pno,Qty). Here Sname is considered unique for each Sno. So, FD of above relation is:

Sno,Pno -> Qty
Sname,Pno -> Qty
Sno ->Sname
Sname->Sno

Sname,Sno is one primary key(it's worded in question). What's the other? How to find it is my question. I've heard about taking closures but here there are 2 attributes in the LHS so I can't see a way to do closures.
 
Physics news on Phys.org
  • #2
It's hard to say much without more information, but I have some questions. You say that "Sname is considered unique for each Sno", but that does not necessarily mean that Sno is unique for each Sname. Is that true?
Does 'S' mean supplier? Does 'Sno' mean the Supplier part number for a part, or is it a number that you have given uniquely to each supplier?
Why do you need both Sname and Sno for a primary key?
Are you sure about Sname ->Sno? Are you saying that there can't be things from two different suppliers with the same name but different part numbers?

IMO, there is a lot left to guess at.
 

FAQ: How to find candidate keys here in DBMS?

What is a candidate key in DBMS?

A candidate key is a minimal set of attributes (columns) in a relation (table) that can uniquely identify a tuple (row) in that relation. In other words, it is a superkey with no redundant attributes.

How do you identify candidate keys in a given relation?

To identify candidate keys, follow these steps:1. Identify all possible superkeys by considering all combinations of attributes that can uniquely identify tuples.2. Eliminate any superkeys that contain redundant attributes, leaving only minimal superkeys, which are the candidate keys.

What is the difference between a candidate key and a primary key?

A candidate key is any minimal set of attributes that can uniquely identify a tuple, while a primary key is a specific candidate key chosen by the database designer to uniquely identify tuples in a table. A table can have multiple candidate keys, but only one primary key.

Can a relation have more than one candidate key?

Yes, a relation can have multiple candidate keys. Each candidate key is an independent set of attributes that can uniquely identify tuples in the relation. However, only one of these candidate keys can be chosen as the primary key.

How do functional dependencies help in finding candidate keys?

Functional dependencies help in finding candidate keys by indicating how attributes relate to each other. If you know the functional dependencies in a relation, you can determine which sets of attributes can uniquely identify tuples. By examining the closure of attribute sets with respect to the functional dependencies, you can identify superkeys and then determine the minimal superkeys, which are the candidate keys.

Similar threads

Replies
2
Views
907
Replies
1
Views
997
Replies
1
Views
3K
Replies
6
Views
2K
Replies
2
Views
11K
Replies
14
Views
4K
Back
Top