Partial Dependency(Databases)

前端 未结 9 1142
时光说笑
时光说笑 2020-11-29 01:19

I need closure on this. I fabricated a definition that partial dependency is when fields are indirectly dependent on the primary key or partially dependent but are also dep

相关标签:
9条回答
  • 2020-11-29 01:41

    Partial Functional Dependency occurs only in relation with composite keys. Partial functional dependency occurs when one or more non key attribute are depending on a part of the primary key.

    Example:

    Table: Stud_id, Course_id, Stud_name, Course_Name

    Where: Primary Key = Stud_id + Course_id

    Then: To determine name of student we use only Stud_id, which is part of primary key.

    {Stud_id} -> {Stud_Name}

    Hence,Stud_name is partially dependent on Stud_id. This is called partial dependency.

    0 讨论(0)
  • 2020-11-29 01:46
    • consider a table={cid,sid,location}
    • candidate key: cidsid (uniquely identify the row)
    • prime attributes: cid and sid (attributes which are used in making of candidate key)
    • non-prime attribute: location(attribute other than candidate key)

    if candidate key determine non-prime attribute:

    i.e cidsid--->location (---->=determining) 
       then, it is fully functional dependent
    

    if proper subset of candidate key determining non-prime attribute:

     i.e sid--->location (proper subset are sid and cid)
             then it is term as partial dependency
    

    to remove partial dependency we divide the table accordingly .

    0 讨论(0)
  • 2020-11-29 01:47

    If there is a Relation R(ABC)

    -----------
    |A | B | C |
    -----------
    |a | 1 | x |
    |b | 1 | x |
    |c | 1 | x |
    |d | 2 | y |
    |e | 2 | y |
    |f | 3 | z |
    |g | 3 | z |
     ----------
    Given,
    F1: A --> B 
    F2: B --> C
    

    The Primary Key and Candidate Key is: A

    As the closure of A+ = {ABC} or R --- So only attribute A is sufficient to find Relation R.

    DEF-1: From Some Definitions (unknown source) - A partial dependency is a dependency when prime attribute (i.e., an attribute that is a part(or proper subset) of Candidate Key) determines non-prime attribute (i.e., an attribute that is not the part (or subset) of Candidate Key).

    Hence, A is a prime(P) attribute and B, C are non-prime(NP) attributes.

    So, from the above DEF-1,

    CONSIDERATION-1:: F1: A --> B (P determines NP) --- It must be Partial Dependency.

    CONSIDERATION-2:: F2: B --> C (NP determines NP) --- Transitive Dependency.

    What I understood from @philipxy answer (https://stackoverflow.com/a/25827210/6009502) is...

    CONSIDERATION-1:: F1: A --> B; Should be fully functional dependency because B is completely dependent on A and If we Remove A then there is no proper subset of (for complete clarification consider L.H.S. as X NOT BY SINGLE ATTRIBUTE) that could determine B.

    For Example: If I consider F1: X --> Y where X = {A} and Y = {B} then if we remove A from X; i.e., X - {A} = {}; and an empty set is not considered generally (or not at all) to define functional dependency. So, there is no proper subset of X that could hold the dependency F1: X --> Y; Hence, it is fully functional dependency.

    F1: A --> B If we remove A then there is no attribute that could hold functional dependency F1. Hence, F1 is fully functional dependency not partial dependency.

    If F1 were, F1: AC --> B;
    and F2 were, F2: C --> B; 
    then on the removal of A;
    C --> B that means B is still dependent on C; 
    we can say F1 is partial dependecy.
    

    So, @philipxy answer contradicts DEF-1 and CONSIDERATION-1 that is true and crystal clear.

    Hence, F1: A --> B is Fully Functional Dependency not partial dependency.

    I have considered X to show left hand side of functional dependency because single attribute couldn't have a proper subset of attributes. Here, I am considering X as a set of attributes and in current scenario X is {A}

    -- For the source of DEF-1, please search on google you may be able to hit similar definitions. (Consider that DEF-1 is incorrect or do not work in the above-mentioned example).

    0 讨论(0)
  • 2020-11-29 01:48

    Partial dependency implies is a situation where a non-prime attribute(An attribute that does not form part of the determinant(Primary key/Candidate key)) is functionally dependent to a portion/part of a primary key/Candidate key.

    0 讨论(0)
  • 2020-11-29 01:53

    I hope this explaination gives a more intuitive appeal to dependency than the answers previously given.

    Functional Dependency

    An analysis of dependency operates on the attribute level, i.e. one or more attribute is determined by another attribute, it comes before the concept of keys. 'The role of a key is based on the concept of determination. 'Determination is the state in which knowing the value of one attribute makes it possible to determine the value of another.' Database Systems 12ed

    Functional dependency is when one or more attributes determine one or more attributes. For instance:

    Social Security Number -> First Name, Last Name.

    However, by definition of functional dependency:

    (SSN, First Name) -> Last Name

    This is also a valid functional dependency. The determinants (The attribute that which determines another attribution) are called super key.

    Full Functional Dependency

    Thus, as a subset of functional dependency, there is the concept of full functional dependency, where the bare minimal determinant is considered. We refer those bare minimal determinants collectively as one candidate key (weird linguistic quirk in my opinion, like the concept of vector).

    Partial Functional Dependency

    However, sometimes one of the attributes in the candidate key is sufficient to determine another attribute(s), BUT not all, in a relation (a table with no rows). That, is when you have a partial functional dependency within a relation.

    0 讨论(0)
  • 2020-11-29 01:57

    A FD (functional dependency) that holds in a relation is partial when removing one of the determining attributes gives a FD that holds in the relation. A FD that isn't partial is full.

    Eg: If {A,B} → {C} but also {A} → {C} then {C} is partially functionally dependent on {A,B}.

    Eg: Here's a relation value where that example condition holds. (A FD holds in a relation variable when it holds in every value that can arise.)

    A  B  C
    1  1  1
    1  2  1
    2  1  1
    

    The non-trivial FDs that hold: {A,B} determines {C}, {B,C}, {A,C} & {A,B,C}; {A}, {B} & {} also determine {C}. Of those: {A,B} → {C} is partial per {A} → {C}, {B} → {C} & {} → {C}; {A} → {C} & {B} → {C} are partial per {} → {C}; the others are full.

    A functional dependency X → Y is a full functional dependency if removal of any attribute A from X means that the dependency does not hold any more; that is, for any attribute A ε X, (X – {A}) does not functionally determine Y. A functional dependency X → Y is a partial dependency if some attribute A ε X can be removed from X and the dependency still holds; that is, for some A ε X, (X – {A}) → Y.

    -- FUNDAMENTALS OF Database Systems SIXTH EDITION Ramez Elmasri & Navathe

    Notice that whether a FD is full vs partial doesn't depend on CKs (candidate keys), let alone one CK that you might be calling the PK (primary key).

    (A definition of 2NF is that every non-CK attribute is fully functionally determined by every CK. Observe that the only CK is {A,B} & the only non-CK attribute C is partially dependent on it so this value is not in 2NF & indeed it is the lossless join of components/projections onto {A,B} & {A,C}, onto {A,B} & {B,C} & onto {A,B} & {C}.)

    (Beware that that textbook's definition of "transitive FD" does not define the same sort of thing as the standard definition of "transitive FD".)

    0 讨论(0)
提交回复
热议问题