Sunday, April 19, 2009

DATABASE AND ER-Diagram

DEFINITION Database

Definition of the database:
A set of data stored in the magnetic disk, optical disk or other secondary storage Collection of integrated data-related data of an enterprise (company, government or private) Is a system which consists of collection of the file (table) in a database in a computer system and a related set of data base management program (DBMS: Database Management System) that allows several users and / or other programs for acess and manipulate files ( table-table) is

for example:
  • Manufacturing companies have data in form of production planning data,actual production data,cmaterial ordering data
  • The hospital has a patient data form of data, doctor, nurse, etc.

DATABASE MANAGEMENT SYSTEM (DBMS)

definition
Collection / database combined with software applications that are based database Application programs are used to access and maintain databases The main purpose DBMS is to provide an environment that is efficient and easy to use, withdrawal and storage of data and information.

Benefits of DBMS
  1. Reducing the repetition of data.
  2. Achieve independence of the data.Specification data stored in each application program.Changes can be made on the structure of data without affecting programs that access the data.
  3. Integrating data from multiple files.When the file was so provide a logical connection, the organization is no longer a physical constraint.
  4. Retrieve data and information quickly.Relationships logical query language allows users to take data in seconds or minutes.
  5. Increase security.Both DBMS Mainframe and micro-computer can include multiple layers such as password security, user directory, language and a password.
Losses DBMS
  1. Obtain the expensive software.
  2. Obtain the configuration of the hardware.
  3. Need for DBA and retain staff.

BIT, BYTE, Field
Data bit is the part that contains the smallest value of 0 or 1
Byte is a set of bit-bit similar with the same 1 byte with 8 bits
Field is a set of byte-byte similar, in the database used the term attribute

ER Diagram Components
  • Entity
  • Attribute
  • Relationship (between entities):
  • Relationship types
  • Role
  • Cardinality

Attribute / Field

It is the nature or characteristics of an entity that provides provide detail on these entities.
For example
an employee has a name, SSN, address, gender, date of birth.
One entity will have specific values for each attribute
For example
a particular employee has the name John Smith, SSN: ... .. Address: Sex: Birthdates: January 5 55
each attribute has a set of values associated with it.
This value is a set of data types, such as integer, string, and the other,
And can also be given a certain range, e.g., date of birth of employee
A relationship can also have attributes
TYPE-TYPE Attribute
Single vs. multi value
Single
can only be filled at most one value
Each entity has a single atomic value
Example: SSN, Sex.

Multi value
can be filled with more than one value with the same type of
an entity can have multiple values
Example:
Color of a CAR
Degree of employee
Expressed as: (color), (title).

Atomic vs. composition
Atomic
can not be divided into the attributes of smaller
Composition
is a combination of several attributes of a smaller
Example:
Address (Apt #, House #, Street, City, State, Zip Code, Country)
Name (first name, Middle Name, Last Name).
The composition can be a hierarchy where the attribute is also a component of composite attribute.
Derived attribute
attribute value can be derived from other attribute values,
e.g. age resulting from the date of birth attribute

Null Value attribute
Attributes that have no value to a record
attribute can have a null value if:
  • Not applicable, e.g. the name for the couple people who are not married
  • Missing: The value but there is not yet known. E.g. high body someone.
  • Not known: You do not know if the value is there. E.g. home phone number.

Mandatory attribute Value
Attributes must have values

RECORD / TUPLE
It is a line of data in a relationship
Consists of the set of attributes where the attribute-attribute-attribute is to inform each other entity / relationship fully
Record is a collection of field-field is structured in a format that has been determined.
During the design of the system, records will be classified as fixed-length records or variable-length record.

Entity / FILE
File is a collection of similar records and have the same elements, the same attributes but different data value
A entities is an "object" (thing) or "object" (object) in the real world that
can be distinguished from all other objects. Entity sets are a set of entities
have the same type. This type of similarity can be seen from the attribute / property that
owned by the individual entities. E.g., group of people who save money on a
bank entities can be defined as a set of customers

File Type
In processing applications, files can categorized as follows:
  • Master File
  • Transaction File
  • File Report
  • File History
  • File Protection
  • Job File
DOMAIN
Domain is the set of values that are allowed to reside in one or more attributes. Each attribute in a database relational is defined as a domain

Element KEY DATA

Key elements of record which is used to find these records at the time of access, or can also be used to identify each entity / record . selection key attributes is important in the design of the database because:
  • to affect validation of data integrity and performance database
  • With declare an attribute as the key and declare 'not allowed duplicates' will prevent the user entering the same data that is not desired
  • A key will be how to maintain the integrity of the key with another key on the table.
Elections key attributes:
  • Key is an attribute that does not change. Example: SSN, employee_ID, SKU (stock-keeping-units), license plate number.
  • Key values can not be null, must have a valid value. Example: Date of students is a bad choice to be a key.
  • Avoid the key that has a certain intelligence or codes built in. Examples: building codes (which can be changed later)
SPECIES OF KEY

Super key is one or more attributes of a table that can be used to identify entity / record of the table are unique (not all attributes can be super key)
Candidate Key is a super key with minimal attributes. Candidate must not contain a key attribute of the table so that the other candidate key is certain super key but not necessarily vice versa.
Primary Key
One of the key attributes of the candidate can be selected / specified a primary key with the three following criteria:
  • Key is more natural to use as reference
  • Key is more simple
  • Key is guaranteed unique
Alternate Key is an attribute of the candidate key is not selected to be primary key.
Foreign Key is any attribute that points to the primary key in another table. Foreign key will be going on a relationship that has cardinalities one to many (one to many) or many to many (many to many). Foreign key is usually always put on the table that point to many.
External Key is a lexical attribute (or set of lexical attributes) that values are always identify an object instance.

ERD (Entity Relationship Diagram)
ERD is a model of a network that uses word order is stored in the abstract system.
Differences between the DFD and ERD
DFD is a model of network functions that will be implemented by the system
ERD is a model that emphasizes the network data on the structure and relationship data
Elements of the ERD

Entity
In the ER Diagram Entity is described with the form of a rectangle. Entity is something that exists in the real system and the abstract where the data stored or where there are data.
Relationship
ER diagram on the relationship can be described with a lozenge. Relationship is a natural relationship that occurs between entities. In general, the name given to the verb base making it easier to do the reading relation.
A relationship connecting the two / more different entity with a specific meaning.
Example:
EMPLOYEE John Smith works on the ProductX PROJECT
EMPLOYEE Franklin Wong manages the Research DEPARTMENT.

Type relationships that are grouped together into a single type. Example:
WORKS_ON relationship type in which employees participate and PROJECTS
MANAGES relationship type in which employees participate and Departments.

Degree of relationship

is the number of entities participating in a relationship. Degree which is often used in the ERD.
Unary Relationship
model is the relationship between the entity originating from the same entity set.
Binary Relationship
model is the relationship between 2 entities.
Ternary Relationship
is a relationship between the instance of 3 types of entities are unilateral.
Cardinalities
tupel indicates the maximum number that can be relation with entities on the other entity

There are 3 cardinalities relations, namely
One to One: Level one to one relationship with the one stated in the entity's first event, only had one relationship with one incident in which the two entities and vice versa.

One to Many or Many to One: Level one to many relationship is the same as the one to many depending on the direction from which the relationship seen .for an incident on the first entity can have any relationship with more incident on the second entity, if the one incident on the entity the second can only have one relation with the incident on the first entity.

Many To Many: if any incident occurs in an entities have relationships with other entities in the incident.
reference
Elmasri & Navathe, Fundamental of Database Systems, 5th Edition, Chapter 1, 2007
DATABASE and ER-DIAGRAM persentation of NGURAH AGUS SANJAYA ER, S.KOM,


No comments:

Post a Comment