السبت، 20 أكتوبر 2012

Designing the database

Designing the database

Data is description of things, activities and transaction with no contacts and no actual meaning. Without technology it's very hard to manage the data because:
·         Data are increased exponentially
·         Data are scattered
·         Data come from different sources (internal, external and personal)
So, organizations use database approach to organize and manage the data by putting them into tables. Database approach is a collection of tables which describe something. These tables must be interacting with each other.
  
There is no one single database for the entire organization. Organizations use many database and usually each database serve a specific purpose.
Before designing the database organization should understand the business. Then they analyse the system and design data base by following some steps:
1.      Choose the business.
2.      List the most important objects of the business which are needed to be successful.
3.      From all objects select objects which we can describe in a table.
4.      Find out the relationship between them which reflect an important process inside the business and what kind of relationship (1:1 , 1:M , M:M).
5.      Draw an entity relationship diagram.
6.      Take every table and define the column (attributes) every field should start with the table name.
7.      Define the primary key (field that uniquely identifies the record and cannot be repeated) if there is no primary key we create one.
8.      Implement the relationship. ( 1:1 no need to do anything , 1:M copy the primary key from one side to many side as an extra field this field cold foreign key used to implement the relationship, M:M create new table ,take both primary keys and put them in to new table then  add columns if its needed and then define the primary key '' some time the primary key can be combination of many columns or you can create new one'') .
9.      Update the entity relationship diagram.