Ketergantungan Fungsional dalam DBMS: Tipe-Tipe dengan Contoh

โšก Ringkasan Cerdas

Functional Dependency is a constraint that determines how one attribute relates to another in a DBMS. It underpins normalization by identifying determinants and dependents, and it is classified into multivalued, trivial, non-trivial, and transitive dependencies.

  • โžก๏ธ Ide Inti: In X โ†’ Y, the determinant X fixes the value of the dependent Y, written with an arrow.
  • ๏ธ Istilah Kunci: Determinant, dependent, axiom, decomposition, and union describe how dependencies are named and manipulated.
  • ๐Ÿ“ Armstrongโ€™s Axioms: Reflexivity, augmentation, and transitivity infer every dependency that a set logically implies.
  • ๐Ÿ”€ Empat Jenis: Multivalued, trivial, non-trivial, and transitive dependencies each describe a distinct attribute relationship.
  • รฐลธยงยน Normalization Link: Dependencies drive normalization, which removes redundancy and update anomalies.
  • ๐Ÿ”‘ Penutupan: The attribute closure reveals candidate keys and whether a dependency holds.
  • โœ… Manfaat: Good dependencies signal good design and separate quality schemas from poor ones.

Ketergantungan Fungsional pada DBMS

Apa itu Ketergantungan Fungsional?

Ketergantungan Fungsional (FD) is a constraint that determines the relation of one attribute to another attribute in a Database Management System (DBMS). Functional dependency helps to maintain the quality of data in the database. It plays a vital role in finding the difference between good and bad database design.

A functional dependency is denoted by an arrow โ€œโ†’โ€. The functional dependency of Y on X is represented by X โ†’ Y. Let us understand functional dependency with an example.

Contoh:

Nomor pekerja nama karyawan Gaji Kota
1 Dana 50000 San Fransisco
2 Francis 38000 London
3 Andrew 25000 Tokyo

In this example, if we know the value of Employee number, we can obtain Employee Name, City, Salary, and so on. By this, we can say that City, Employee Name, and Salary are functionally dependent on Employee number.

Ketentuan Utama

Here are some key terms for functional dependency in a database:

Ketentuan Utama Deskripsi
Aksioma Axioms are a set of inference rules used to infer all the functional dependencies on a relational database.
Penguraian A rule that suggests if you have a table that appears to contain two entities determined by the same primary key, you should consider breaking it into two different tables.
Tergantung It is displayed on the right side of the functional dependency diagram.
penentu It is displayed on the left side of the functional dependency diagram.
Serikat It suggests that if two tables are separate and the primary key is the same, you should consider putting them together.

Rules of Functional Dependencies (Armstrongโ€™s Axioms)

Below are the three most important rules for functional dependency in a database. They are known as Armstrongโ€™s axioms, and every other inference rule can be derived from them.

  • Reflexive rule: If X is a set of attributes and Y is a subset of X, then X โ†’ Y holds.
  • Augmentation rule: When X โ†’ Y holds and C is an attribute set, then XC โ†’ YC also holds. Adding attributes does not change the basic dependency.
  • Transitivity rule: Similar to the transitive rule in algebra: if X โ†’ Y holds and Y โ†’ Z holds, then X โ†’ Z also holds.

Three further rules are derived from these and are used constantly in practice:

  • Union rule: if X โ†’ Y and X โ†’ Z, then X โ†’ YZ.
  • Decomposition rule: if X โ†’ YZ, then X โ†’ Y and X โ†’ Z.
  • Pseudo-transitivity rule: if X โ†’ Y and WY โ†’ Z, then WX โ†’ Z.

Applying these rules repeatedly to a set of dependencies produces its penutupan, the complete set of dependencies that logically follow. The closure of an attribute set is also how candidate keys are found, which links directly to the study of DBMS keys.

Jenis Ketergantungan Fungsional dalam DBMS

There are mainly four types of functional dependency in DBMS:

  • Ketergantungan Multinilai
  • Ketergantungan Fungsional Sepele
  • Ketergantungan Fungsional Non-Sepele
  • Ketergantungan Transitif

Ketergantungan Multinilai dalam DBMS

Multivalued dependency occurs in a situation where there are multiple independent multivalued attributes in a single table. A multivalued dependency is a complete constraint between two sets of attributes in a relation, requiring that certain tuples be present. Consider the following example.

Contoh:

Model mobil Maf_tahun Warna
H001 2017 Metalik
H001 2017 Hijau
H005 2018 Metalik
H005 2018 Biru
H010 2015 Metalik
H033 2012 Abu-abu

In this example, Maf_year and Color are independent of each other but dependent on Car_model. These two columns are said to be multivalue dependent on Car_model. This is represented as:

car_model โ†’ maf_year

car_model โ†’ colour

Ketergantungan Fungsional Sepele dalam DBMS

A trivial dependency is a set of attributes that is called trivial if the set of attributes is included in that attribute. So, X โ†’ Y is a trivial functional dependency if Y is a subset of X. Consider the example below.

Em_id Nama_emp
AS555 menyerobot
AS811 George
AS999 Kevin

Consider this table with two columns, Emp_id and Emp_name. {Emp_id, Emp_name} โ†’ Emp_id is a trivial functional dependency, as Emp_id is a subset of {Emp_id, Emp_name}.

Non-Trivial Functional Dependency in DBMS

A non-trivial dependency occurs when A โ†’ B holds true and B is not a subset of A. If attribute B is not a subset of attribute A, the dependency is considered non-trivial.

Perusahaan CEO Usia
Microsoft Satya Nadella 51
Google Sundar Pichai 46
Apple Tim Cook 57

Contoh:

{Company} โ†’ {CEO} (if we know the Company, we know the CEO name). But CEO is not a subset of Company, and hence it is a non-trivial functional dependency.

Ketergantungan Transitif dalam DBMS

A transitive dependency is a type of functional dependency that happens when an attribute is indirectly determined by two functional dependencies. Consider the example below.

Perusahaan CEO Usia
Microsoft Satya Nadella 51
Google Sundar Pichai 46
Alibaba Jack Ma 54

{Company} โ†’ {CEO} (if we know the company, we know its CEOโ€™s name).

{CEO} โ†’ {Age} (if we know the CEO, we know the age).

Therefore, by the rule of transitive dependency, {Company} โ†’ {Age} should hold, which makes sense because if we know the company name, we can find the age.

Note: transitive dependency can only occur in a relation of three or more attributes.

Apa itu Normalisasi?

Normalization is a method of organizing the data in a database that helps you avoid data redundancy and insertion, update, and deletion anomalies. It is a process of analyzing the relation schemas based on their different functional dependencies and primary key.

Normalization is inherent to relational database theory. It may have the effect of splitting data across additional tables so that each fact is stored once. The full process is covered in the guide to normalisasi basis data, which builds directly on the dependency types above.

Keuntungan Ketergantungan Fungsional

  • Functional dependency avoids data redundancy, so the same data does not repeat at multiple locations in the Database.
  • It helps you maintain the quality of data in the database.
  • It helps you define the meanings and constraints of databases.
  • It helps you identify bad designs.
  • It helps you find the facts regarding the database design.

Pertanyaan Umum Demo Slot

The determinant is the attribute on the left of the arrow that fixes the value. The dependent is the attribute on the right whose value is determined. In X โ†’ Y, X determines Y.

A functional dependency fixes a single value for the dependent. A multivalued dependency allows a set of independent values, which is why it needs its own attribute and leads to fourth normal form.

Compute the closure of an attribute set using the dependencies. If the closure includes every attribute of the relation, that set is a superkey; the minimal such set is a candidate key.

Yes. Dependency-discovery algorithms, some AI assisted, scan a dataset and propose candidate dependencies. A designer must confirm them, because a pattern true in sample data may not hold as a rule.

It stores a fact about a non-key attribute, so updating it risks anomalies. Removing transitive dependencies is exactly what third normal form requires, which keeps each fact in one place.

Ringkaslah postingan ini dengan: