super key, candidate key, primary key

In the SQL Server database, there is a student information table as shown below, the attribute set that cannot be used as a candidate key in this table is ( ) (select one)

Student ID, Name, Sex, Age, Department, Major 
20020612 Li Huinan 20 Computer Software Development 
20060613 Zhang Mingnan 18 Computer Software Development 
20060614 Wang Xiaoyunv 19 Physical Mechanics  20060615
Li Shuhua Female 17 
Biozoology 20060616 Zhao Jingnan 21 Chemical Food Chemistry 
20060617 Zhao Jingnv 20 Biological Botany  
a) {student number} 
b) {student number, name} 
c) {age, department} 
d) {name, gender} 
e) {name, major}


    Maybe you don't know how to choose. If we can answer this question correctly, then we have a very deep understanding of the concept of super key and candidate key and primary key. 
    Look at the concept: 
        super key: The set of attributes that can uniquely identify a tuple in a relationship is called a super key of the relational schema.
        Candidate key: A super key that does not contain redundant attributes is called a candidate key. That is, in the candidate key, if you want to delete the attribute, it is not a key. 
        Primary key: A candidate key selected by the user as a tuple identity is called the primary key. 
    Through the concept, we can understand that the super key contains the candidate key, and the candidate key contains the primary key. Primary keys must be unique. why? Because his grandfather's super key is the only one. 
    Let's analyze the above questions, abcde5 answers can be used as super keys, and their combined set can be used to uniquely identify a data record (entity). 
    Note our requirement: candidate keys. The candidate key requirement is a super key that cannot contain redundant attributes, let's look at answer b. In answer b, if we can uniquely identify a data entity without using a name, it can be said that the name field is redundant here. Then obviously, the b option contains redundant field attributes. Then the answer to this question should choose b, then the other 4 options can be used as candidate keys. Assuming lucky, a) student ID is selected as the candidate key that the user is using to uniquely identify the tuple, then he is lucky to get primary key name 


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324510595&siteId=291194637