-=- yOe -=-

Minggu, 26 April 2009

Normalization

database planning process
>collecting requirement of users or business
>developing E-R model based on requirement of users or business
>converting E-R model to collection of relation (table)
>normalization relatio for eliminating anomaly
>implementation of database with creating table for each relation that had normalization

database normalization
>normalization is forming process of database structure so most of ambiguity can be eliminating
>normalization stage started from lighter stage (1NF) to tighter stage(5NF)
>usually, only reaching at level 3NF or BCNF because its quite for producting tables in good quality
>why we do normalization?
>>>optimalizing of table structures
>>>increasing speed
>>>eliminating of the same input data
>>>more efficient in using storage
>>>decreasing redundancy
>>>avoid anomaly (insertion anomalies, deletion anomalies, update anomalies).
>>>increase data integrity
>a table told great (efficient) or normal if fulfilling 3 criteria, that is :
1. if there are decomposition table, so decomposition must guaranteed to be safe (Lossless-Join Decomposition). its mean, after the table was elaborated become new tables, that tale can relsulting the same previously table
2. looking after to depended of functional at data changes (Dependency Preservation).
3. not break the Boyce-Code Normal Form (BCNF)
>if third criteria (BCNF) cannot complete, at least the table ot break normal form third stage (3rd Normal Form/ 3NF)

functional dependency
>described connection of attributes in a relation
>an attribute told as functionally dependant inother if we using attribute value for determine another attribute value
>symsbol that used is for deputizing functional dependency that read as functional to determine.
>notation : A -> B
>>>A and B is attribute from a table. its means as functional A determine B or B depended in A, if and as if there are 2 row data with same A value, so B value can be same
>notation : A-/>B or Ax->B
>>>it is reverse from previously notatioen.
>example:

>>Functional Dependency:
>>>NRP -> Nama
>>>Mata_Kuliah, NRP -> Nilai
>>Non Functional Dependency:
>>>Mata_Kuliah -> NRP
>>>NRP -> Nilai
>functional dependency from value table is
>>>Nrp -> Nama, because for each value of Nrp is same, so name value same too
>>>{Mata_kuliah, NRP} -> Nilai, because value attribute depend on Mata_kuliah and Nrp as at same time. in other mean, for Mata_kuliah and Nrp that same, value will same too, because Mata_kuliah and Nrp was representing key (in unique characther)
>>>Mata_kuliah -> NRP
>>>NRP -> Nilai

first normal form - 1NF
>a table that told as first normal form if it not as unnormalized form table, where happen duplication of same kind field and possible for exist null field
>not be able for:
>>>multivalued attribute
>>>composite attribute or combination of both so price of attribute domain must atomic price.
>for example :
>>>data mahasiswa

>>>this tables not up to standard of 1NF
>>>decomposition become :


second normal form - 2NF
>2NF completed in a table if up to standard of 1NF, and all attribute except primery key, intactly have functional dependency on primary key
>a table not complete as 2NF if there are attribute that only have a partial functional dependency
>if there are attribute that not have dependency of primary key, so that attribute have to moved or eliminated
>functional dependency X -> Y told as complete if deleting a attribute A from X, that's mean Y not depend as functional anymore
>functional dependency X -> Y told as partial if deleting a attribute A from X, that's mean Y still depend as functional
>relation schema R in 2NF form if each attribute non primary key A is member of R depend on as complete as functional in primary key R
>example :this table complete 1NF, but not include as 2NF
>>>not complete as 2NF, because {NIM,KodeMk} assumed as primary key, while
{NIM, KodeMk} -> NamaMhs
{NIM, KodeMk} -> Alamat
{NIM, KodeMk} -> Matakuliah
{NIM, KodeMk} -> Sks
{NIM, KodeMk} -> NilaiHuruf
>>>that table need to decomposition become several table that p to standard 2NF
>>>the Functional dependency is:
{NIM, KodeMk} -> NilaiHuruf (fd1)
NIM -> {NamaMhs, Alamat} (fd2)
KodeMk -> {Matakuliah, Sks} (fd3)
>>>So :
fd1 (NIM, KodeMk, NilaiHuruf) -> Tabel Nilai
fd2 (NIM, NamaMhs, Alamat) -> Tabel Mahasiswa
fd3 (KodeMk, Matakuliah, Sks) -> Tabel MataKuliah

third normal form - 3NF
>3NF complete if have standard of 2NF form, and if there are no attribute non primary key that have dependency with other attribute non primary key (transitive dependensy)
>example :
>>>this table was up to standard of 2NF, but not complete as 3NF

>>>because there are still have an attribute of non primary key (viz, Kota and Provinsi) that have dependency with other attribute non primary key(viz, KodePos)
KodePos -> {Kota,Provinsi}
>>>until that table has to decomposition become Mahasiswa (NIM, NamaMhs, Jalan, KodePos) and KodePos (KodePos, Provinsi, Kota)

Boyce-Codd Normal Form (BCNF)
>BCNF has more powerful force and 3NF. for become BCNF, relation must in form of 1NF and each attribute forced depend on function at super key attribute
>for example : there are seminar relation, primary key is NPM + Seminar.
>case : student is able to take a or two seminar. each seminar need 2 counsellor and each studet guided by one of them. each counsellor only able to take one seminar. in this example, NPM and seminar showing a counsellor.

>sminar relation form is 3NF, but not BCNF because seminar code still depend with function on counsoller. if each counsellor has teach omly one seminar. seminar depend on one attribute that not super key as standardization as BCNF, so seminar relation must divided become two, that is :



4NF and 5NF
>relation is fourth normal form - 4NF, if relation in BCNF and no involved dependency multivalue. for eliminating dependency multivalue from one relation, we divide relation become two new relation. each relation containing two attribute that have multivalue connection.
>relation is fifth normal form - 5NF deal with property that known as join without losing information (lossless join). 5NF as known as PJNF or projection join normal form.this case is very rare emerge and difficult to detected practically

REFERENCE :
- NGURAH AGUS SANJAYA ER, S.KOM, M.KOM. Slide presentasi : Part 6 - DATABASE NORMALISASI

Jumat, 17 April 2009

ER-Diagram

Database and ERD (Entity Relationship Diagram)
definition of database
- database is group of data that stored into magnetic disk, optical disk, or another secondary data storage.
- fused collection of datas, that connected mutually, from an enterprise (a company, firm, and government).
  • manufacture company -> production planning data, actual production data, material ordering data, etc
  • hospital -> data of patient, doctor, nurse, etc

DBMS (Database Management System)

- compilation of database with software application based on database

- the programs of application used for access and take care of database

- main purpose of DBMS is to provide an environment that easier and efficient for using, drawing and saving data and information.

definition of bit, byte, and field

- bit -> smallest part that have some value of 0 and 1

- byte -> collection of same bits

- field -> collection of same bytes as known as attribute


types of attribute

- single vs multivalue

  • single -> only can containing mostly 1 value
  • multivalue -> can containing more than 1 value with same kind value
- atomic vs composition
  • atomic -> cannot divided into smaller attribute
  • composition -> alliance of smaller attribute

- derived attribute -> attribute that can be yield from other attribute value, for example : age can be yield from attribute of birth datenull

- value attribute -> attribute with no value for a record

- mandatory value attribute -> attribute that must have a value
record or tupple
- a data row inside a relation
- consist of attribute collection which attribute interaction for advising entity or relation as detail
entiry or file
- file is collection of record that have same kind and same element, which the same attribute, but different data value.
- Type of file
In application process, file can be categorized as :
  • Main file
  • Transaction file
  • Report file
  • History file
  • Protector file
  • Activity file

Domain

- collection of value that can be inside one or more attribute.

- Each attribute in database relation defined as domain.

Element key of data

- Key is element of record that used for finding its in access time or can be used for identification each entity/record/row.

Types of key
- Superkey is one or more attribute that can be used for identification entity/record in table as uniquely (not all of attribute can be superkey).
- Candidate key is supperkey with minimal attribute. Candidate key cannot containing the attribute from other table, so candidate key already definite as superkey but not yet the other way.
- Primary key is one of candidate key that can be chosen or determined as primary key with 3 category, that is :
  1. key is more natural for used as reference
  2. key is more simple
  3. key is guaranteed the unique

- alternate key is attribute from candidate key that not chosen as primary key

- Foreign key is any kind attribute that showing to primary key in other table. Foreign key happen in a relation that having cardinality one-to-many or many-to-one. Usually, Foreign key always put in table direct to many.
External key is a lexical attribute (or compilation of lexical attribute) that its value always identification one object instance.

ERD or Entity Relationship Diagram

- A model using word structure that saved in system as abstract,

- Difference between DFD and ERD

  • DFD is a function network model that will executed by system
  • ERD is data network model that emphasize in structure and relationship data.

The elements of ERD

- Entity
  • Something exist inside real system or abstract system which data stored or where are the data.
  • Symbolized as square of length. There are also line symbol as link between compilation of entity with entity and compilation entity with its attribute.

- Relationship

  • Natural Relation happened between entity.
  • Generally, given name with basic verb that facilitating for reading its relation.
  • Symbolized as rhomb

- Relationship degree

  • Account of entity that participated inside a relationship.
  • Degree is often used in ERD\

- Attribute

  • Characteristic of each entity or relationship
  • Symbolized as circle
- Cardinality
  • Showing maximal account tupel that can be relation with entity in the other one.

Relationship degree

- Unary relationship is Relationship model happen between the entity which coming from the same entity set.

- Binary relationship is relationship model happen between 2 entity.
- Ternary relationship between instance of 3 entity unilaterally.
Cardinality

- There are 3 cardinality relation, that is :

  • One-to-one : relationship degree one-to-one expressed by one event in first entity, only have one relation with one event in second entity and on the contrary.
  • One-to-many or many-to-one : relationship degree one-to-many is equal many-to-one dependent from where that relationship seen. For one event in first entity can have many relationship with event in second entity, the other way, one event in second entity only have relationship with one event in first entity.
  • Many-to-many : happen if each event in an entity having a lot of relationship with event in other entity

Example : cardinality



reference :
- NGURAH AGUS SANJAYA ER, S.KOM, M.KOM. Slide presentasi : Part 5 - DATABASE DAN ER-DIAGRAM.


Jumat, 03 April 2009

DFD(Data Flow Diagram) Quiz

Data Flow Diagram (DFD) describe division of system into smaller module. it is easier for user that not quite understand about computer to know how system works.

Context Diagram
> consist of a process and describing scope from a system
> the highest level from DFD that describing all input to system and output from system.
> system limited by boundary (that described with dash line)
> there is not be able to storage.

Zero Diagram
> describing process of DFD
> giving opinion totally about handled system, indicate function or main process that exist, data flow and external entity.
> in this level, enable for data storage.
> for unexplained process in next level ,then addicted symbol ‘*’ or ‘P’ in last number of process.
> balancing input and output between Zero diagram and context diagram must protected.

Detail Diagram
> the diagram that explaining what process inside zero diagram or next up level.
> number sequence level of DFD







> inside a level better not have more than 7 process and maximal 9, if more then must do decomposition.

Process Specification
> every process in DFD must have process specification
> in top level method that used for describing process with descriptive sentence
> in detail level that is in bottom process (functional primitive) requiring specification more structured.
> process specification can be guide for programmer in coding
> method that used in process specification: explain process in narrative, decision table, decision tree.

External Unity
> Something outside system, but its giving data into system or giving data from system
> symbol by box notation
> external entity not included as part as system
> giving name :
==> terminal name in the form of noun
==>terminal cannot have the same name, except the same object

Data Flow
> representing place stream of information
> described with straight line that connecting component from system
> data flow shown with arrow and line that given name as stream data flow
> data flow stream among process, data storage and showing data flow from data as input for system
> guidance of giving name :
==> name of data flow consist of some word stream connected with continue line
==> there is can’t be data flow that have same name and giving name must expressing its.
==> data flow consist of some element can be expressed with element group
==> avoid usage of word ‘data’ and ‘information’ for giving a name in data flow
==> as possible, the name of data flow fully written
> another rules :
==> the name of data flow enter into a process cannot same with the name of data flow that out from that process
==> data flow that in or out from data storage haven’t to given name if :
====> simple data flow and easier to understand
====> data flow describing all data item
==> there are can’t be data flow from terminal to data storage or on the contrary because terminal is not part of system, connection between terminal and data storage must pass process



Process
> process represented what system done
> process can turn data or input data flow into output data flow
> process functioning for transformation one or some input data become one or more output data appropriate with specification needed
> every process have one or some input and resulting one or some output
> process as known as bubble
> guidance of giving name process :
==> name process consist of verb and noun that expressing its function process
==> don’t using process word as part name a bubble
==> there is can’t be some process have the same name
==> process must given number. Number sequence as possible follow stream or process sequence. However number sequence can’t absolutely represented process sequence chronologically.

Data Storage
> represented existing data repository in system
> symbol with a couple of parallel line or two line with one of other side was open.
> process can taking data from or giving data to database
> guidance of giving name :
==> name must expressing data storage
==> if its name more that one word then must given continued sign

Symbol DFD


Data Dictionary
> function as helping system performer for interpreting application in detail and organizing all data element that used system precisely until user and system analyst having same basic knowledge about input, output, storage and process
> in analysis stage, data dictionary used as communication tools between system analyst and user
> in system planning stage, data dictionary used for make an input, report and database
> Data flow in DAD having global character, for more information can seen in data dictionary
> data dictionary loading the followings :
==> name of data flow: have to recorded in order to reader that needing more clarification about a data flow can easy to search
==> data form : used for grouping data dictionary into usage when system planning
==> data flow : showing where data streaming from and go.
==> clarification : giving explain about the meaning from data flow

Balancing inside DFD
> data flow that in into and out from one process must same with data flow that in into and out from process detailed in bottom level/standard
> the name of data flow that in into and out from one process must same with data flow that in into and out from process detailed
> amount and external entity name from a process must same with amount and external entity name from its process detailed
> things which must have to attention in DFD owning more than one level :
==> there is balancing input and output between one level and next level
==> balancing between level 0 and level 1 seen in input/output from data flow to or from terminal in level 0, while balancing between level 1 and level 2 seen in input/output from data flow to or from its process
==> name of data flow, data storage and terminal in each level must same if have same object

Prohibition inside DFD
> data flow mustn’t from external entity direct to other external entity without pass a process
> data flow mustn’t from data storage direct to external entity without pass a process
> data flow mustn’t from data storage direct to other data storage without pass a process
> data flow from one process direct to other process without pass a data storage better to / as possible avoided

reference:
> Slide PPT : Part 4 -DATA FLOW DIAGRAM, oleh : NGURAH AGUS SANJAYA ER, S.KOM, M.KOM