Presentation on theme: "Overview Of Relational DBMS Presented by Satrio Agung Wicaksono."— Presentation transcript:
Overview Of Relational DBMS Presented by Satrio Agung Wicaksono
Relational Database Concepts A database is a repository of data, designed to support efficient data storage, retrieval and maintenance Relational databaseis a database modeled by relations RelationR defined over n sets D1, D2, …Dnwhere Di represents some domain. n-tuple(tuple) is a set where d1εD1, d2εD2, …
Sample Database Scheme The relation schemas for this database can be defined as follows: EMP(ENO, ENAME, TITLE, SAL, PNO, RESP, DUR) PROJ(PNO,PNAME, BUDGET)
Key Super Key : uses keys to define identifiers for a relation’s tuples used to enforce rules and/or constraints on database data. Candidate Key is a unique identifier for the tuples of a relation most relations have multiple candidate keys Primary Key candidate key that is chosen to represent the relation in the database and to provide a way to uniquely identify each tuple of the relation Alternate Key the remaining candidate keys
The problem of redundancy Data redundancy implies finding the same data in more than one location within deatabase tables The following problems Repetition anomaly Insertion Anomalies Deletion Anomalies Update Anomalies Cont’d….
Repetition anomaly Repetition anomaly : Certain information may be repeated unnecessarily This is obviously a waste of storage and is contrary to the spirit of databases NIMNAMAPRODIK_MKTHN_MKTHN_AKADEMIKSEMESTERNAMA_MKSKSNILAI 10509xxxWiraIlkomSIF150122012 GanjilBDT3A 10509xxxWiraIlkomSIF150112012 GanjilABD3A
Insertion Anomalies insertion anomaly : happens when the insertion of a data record is not possible unless we also add some additional unrelated data to the record NIMNAMAPRODIK_MKTHN_MKTHN_AKADEMIKSEMESTERNAMA_MKSKSNILAI 10509xxxWiraIlkomSIF150122012 GanjilBDT3A 10509xxxWiraIlkomSIF150112012 GanjilABD3A
Deletion Anomalies deletion anomaly happens when deletion of a data record results in losing some unrelated information that was stored as part of the record that was deleted from a table NIMNAMAPRODIK_MKTHN_MKTHN_AKADEMIKSEMESTERNAMA_M K SKSNILAI 10509xxxWiraIlkomSIF150122012 GanjilBDT3A 10506xxxWiriTIFSIF150122012 GanjilBDT3A
Update Anomalies An update anomaly occurs when updating data for an entity in one place may lead to inconsistency, with the existing redundant data in another place in the table NIMNAMAPRODIK_MKTHN_MKTHN_AKADEMIKSEMESTERNAMA_MKSKSNILAI 10509xxxWiraIlkomSIF150122012 GanjilBDT3A 10509xxxWiraIlkomSIF150112012 GanjilABD3A
Decompositions Decomposition in relational database design implies breaking down a relational schema into smaller and simpler relations that avoid redundancy. The idea is to be able to query the smaller relations for any information that we were previously able to retrieve from the original relational schema NIMNAMAPRODIK_MKTHN_MKTHN_AKADEMIKSEMESTERNAMA_MKSKSNILAI 10509xxxWiraIlkomSIF150122012 GanjilBDT3A 10506xxxWiriTIFSIF150122012 GanjilBDT3A NIMNAMAPRODI 10509xxxWiraIlkom 10506xxxWiriTIF NIMK_MKTHN_MKTHN_AKADEMIKSEMESTERNAMA_MKSKSNILAI 10509xxxSIF150122012 GanjilBDT3A 10506xxxSIF150122012 GanjilBDT3A
Functional Dependencies Functional Dependency (FD) i: a type of integrity constraint that extends the idea of a super key. It defines a dependency between subsets of attributes of a given relation Functional Dependency can be understood as “A determines B”, “B is dependent on A” or “A implies B” and denoted as “A → B”.
Functional Dependencies Example Set Of Functional Dependecies …? NIMNAMAPRODIK_MKTHN_KURIKULUMTHN_AKADEMIKSEMESTERNAMA_MKNILAI 10509xxxWiraIlkomSIF150122012 GanjilBDTA 10509xxxWiraIlkomSIF150112012 GanjilABDA
Normal Forms Normalization is a procedure in relational database design that aims at converting relational schemas into a more desirable form The goal is to remove redundancy in relations and the problems that follow from it, namely insertion, deletion and update anomalies. Type of Normal Form: First Normal Form (1NF) Second Normal Form (2NF) Third Normal Form (3NF) Boyce-Codd Normal Form (BCNF
First Normal Form (1NF) A relation is considered to be in first normal form if all of its attributes have domains that are indivisible or atomic A table is in 1NF if and only if it satisfies the following five conditions : There is no top-to-bottom ordering to the rows. There is no left-to-right ordering to the columns. There are no duplicate rows Every row-and-column intersection contains exactly one value from the applicable domain (and nothing else). All columns are regular [i.e. rows have no hidden components such as row IDs, object IDs, or hidden timestamps]. Cont’d….
First Normal Form (1NF) NIMNAM A NO_HPFAKPROD I K_MKTHN_KURIK ULUM THN_AKADE MIK SEMESTE R NAMA_ MK SKSNILA I 10509xx x Wira0821xxx 08775xx PTIIKIlkomSIF150 12 2012 GanjilBDT3A 10506xx x Wiri08555xx 0888xxx PTIIKTIFSIF150 12 2012 GanjilBDT3A NIMNAM A NO_HPFAKPRO DI K_MKTHN_KURI KULUM THN_AKADE MIK SEMESTE R NAMA_ MK SKSNIL AI 10509xx x Wira0821xxxPTII K IlkomSIF1501 2 2012 GanjilBDT3A 10509xx x Wira08775xxPTII K IlkomSIF1501 2 2012 GanjilBDT3A 10506xx x Wiri08555xxPTII K TIFSIF1501 2 2012 GanjilBDT3A 10506xx x Wiri0888xxxPTII K TIFSIF1501 2 2012 GanjilBDT3A 1NF transformation
First Normal Form (1NF) NIMNAM A NO_HPFAKPRO DI K_MKTHN_ MK THN_AKADE MIK SEMEST ER NAMA_ MK SKSNILAI 10509xx x Wira0821xxx 08775xx PTIIKIlkomSIF150 12 2012 GanjilBDT3A 10506xx x Wiri08555xx 0888xxx PTIIKTIFSIF150 12 2012 GanjilBDT3A NIMNAMAFAKPRODI 10509xxxWiraPTIIKIlkom 10506xxxWiriPTIIKTIF NIMNO_HP 10509xxx0821xxx 10509xxx08775xx 10506xxx08555xx 10506xxx0888xxx NIMK_MKTHN_M K THN_AKADEM IK SEMESTE R NAMA_ MK SKSNILA I 10509xx x SIF150 12 2012 GanjilBDT3A 10506xx x SIF150 12 2012 GanjilBDT3A
Second Normal Form (2NF) A relation is in second formal form when it is in 1NF and there is no such non-key attribute that depends on part of the candidate key, but on the entire candidate key NIMNAMAFAKPRODI 10509xxxWiraPTIIKIlkom 10506xxxWiriPTIIKTIF NIMNO_HP 10509xxx0821xxx 10509xxx08775xx 10506xxx08555xx 10506xxx0888xxx NIMK_MKTHN_MKTHN_AKADEMIKSEMESTERNILAI 10509xxxSIF150122012 GanjilA 10506xxxSIF150122012 GanjilA K_MKTHN_MKNAMA_MKSKS SIF15 012 2012BDT3 SIF15 012 2012BDT3
Third Normal Form (3NF) A relation is in third normal form if it is in 2NF and there is no such non-key attribute that depends transitively on the candidate key. That is every attribute depends directly on the primary key and not through a transitive relation where an attribute Z may depend on a non-key attribute Y and Y in turn depends on the primary key X Transitivity means that when X→Y and Y→ Z, then X→Z. Cont’d…
Third Normal Form (3NF) NIMNAMAPRODI 10509xxxWiraIlkom 10506xxxWiriTIF NIMNO_HP 10509xxx0821xxx 10509xxx08775xx 10506xxx08555xx 10506xxx0888xxx NIMK_MKTHN_MKTHN_AKADEMIKSEMESTERNILAI 10509xxxSIF150122012 GanjilA 10506xxxSIF150122012 GanjilA K_MKTHN_MKNAMA_MKSKS SIF15 012 2012BDT3 SIF15 012 2012BDT3 FAKPRODI PTIIKIlkom PTIIKTIF
Boyce-Codd Normal Form (BCNF) Boyce-Codd Normal Form is a stricter version of 3NF that applies to relations where there may be overlapping candidate keys. A relation is said to be in Boyce-Codd normal form if it is in 3NF and every non-trivial FD given for this relation has a candidate key as its determinant. That is, for every X → Y, X is a candidate key.
Boyce-Codd Normal Form (BCNF) K_MKTHN_MKTHN_AKADEMIKSEMESTERKELASPRODIHARI_KE SIF150122012 GanjilAILKOM1 SIF150122012 GanjilATIF2 PTI150072012 GanjilATIF2 PTI150072012 GanjilATIF5
Relational Algebra Relational algebra is a set of operators to manipulate relations Defined 8 such operators, two groups of 4 each: The traditional set operations: union, intersection, difference and Cartesian product The special relational operations: select, project, join and divide
Union The union of two union-compatible relations R1 and R2, R1 UNION R2, is the set of all tuples t belonging to either R1 or R2 or both The formal notation for a union operation is U
Intersection The intersection of two union-compatible relations R1 and R2, R1 INTERSECT R2, is the set of all tuples t belonging to both R1 and R2. The formal notation for an intersect operation is ∩.
Difference The difference between two union-compatible relations R1 and R2, R1 MINUS R2, is the set of all tuples t belonging to R1 and not to R2. The formal notation for a difference operation is -
Cartesian product The Cartesian product between two relations R1 and R2, R1 TIMES R2, is the set of all tuples t such that t is the concatenation of a tuple r belonging to R1 and a tuple s belonging to R2. The concatenation of a tuple r = (r1, r2, …, rm) and a tuple s = (sm+1, sm+2, …, sm+n) is the tuple t = (r1, r2, …, rm, sm+1, sm+2, …, sm+n). R1 and R2 don’t have to be union-compatible. The formal notation for a Cartesian product operation is ×
Selection The select operation selects a subset of tuples from a relation. It is a unary operator, that is, it applies on a single relation. The tuples subset must satisfy a selection condition or predicate. The formal notation for a select operation is: σ ( ) where is / [AND/OR/NOT / …] The comparison operator can be, =, =, <> and it depends on attribute domain or data type constant value
Projection The project operation builds another relation by selecting a subset of attributes of an existing relation. Duplicate tuples from the resulting relation are eliminated. It is also a unary operator. The formal notation for a project operation is: π ( ) where is the subset attributes of an existing relation
JOIN The join operation concatenates two relations based on a joining condition or predicate. The relations must have at least one common attribute with the same underlying domain, and on such attributes a joining condition can be specified. The formal notation for a join operation is: R ►◄ S where is The comparison operator can be, =, =, <> and it depends on attributes domain.
Division The division operator divides a relation R1 of degree (n+m) by a relation R2 of degree m and produces a relation of degree n. The (n+i)th attribute of R1 and the ith attribute from R2 should be defined on the same domain. The result of a division operation between R1 and R2 is another relation, which contains all the tuples that concatenated with all R2 tuples are belonging to R1 relation. The formal notation for a division operation is ÷.
Your consent to our cookies if you continue to use this website.