Saturday, 23 January 2016

Modelling with ER diagram

Entity-relationship diagram

                  An entity relationship model, also called an entity-relationship (ER) diagram, is a graphical representation of entities and their relationships to each other, typically used in computing in regard to the organization of data within databases or information systems.

Entity
                   Entities are represented by means of rectangles. Rectangles are named with the entity set they represent.

Entity
Weak entity
                Weak entity is an entity that cannot be uniquely identified by its attributes alone. It could be represented by double bordered rectangle
Attributes
                Attributes are the properties of entities. Attributes are represented by means of ellipses.

Multi valued attributes
               Multi-value attributes may contain more than one value. For example, a person can have more than one phone number, email_address, etc.

Derived attributes:
           Derived attributes are the attributes that do not exist in the physical database, but their values are derived from other attributes present in the database. 
           
               For example, average_salary in a department should not be saved directly in the database, instead it can be derived. For another example, age can be derived from data_of_birth.

Key Attribute
             
Key is an attribute or collection of attributes that uniquely identifies an entity among entity set.
Examples for entity and attribute

Employee Table


Example 2 : Summary

Relationship:
                   Relationships are represented by diamond-shaped box. Name of the relationship is written inside the diamond-box.
Relationship Symbol
Weak relationship
                    A weak relationship type is represented by a double diamond. 

Weak Relationship
The following diagram is the ER-diagram of the Company Database with the specifications







Thursday, 7 January 2016

Network data model

Network data model


  1. A network database model is a database model that allows multiple records to be linked to the same owner file. 
  2. The model can be seen as an upside down tree where the branches are the member information linked to the owner.
    Network Model : Tree of Record View

Advantages of a Network Database Model
  1. Because it has the many-many relationship, network database model can easily be accessed in any table record in the database
  2. For more complex data, it is easier to use because of the multiple relationship founded among its data
  3. Easier to navigate and search for information because of its flexibility
Disadvantage of a Network Database Model
  1. Difficult for first time users
  2. Difficulties with alterations of the database because when information entered can alter the entire database

Relational Data Model.

Relational Data Model  

Relational model stores the data in the form of table. It consists of three major components.
  1. The set of relations and set of domains that defines the way data can be represented.
  2. Integrity rules that defines the procedure to protect the data.
  3. The operations that can be performed on the table.
Advantages:
  1. Ease of use: 
    • Any information as tables consisting of rows and columns is much easier to understand .
  2. Flexibility: 
    • Different tables from which information has to be linked and extracted can be easily. 
  3. Security: 
    • Security control and authorization can also be implemented more easily by moving sensitive attributes in a given table into a separate relation with its own authorization controls.
  4. Data Independence: 
    • Data independence is achieved more easily with normalization structure used in a relational database than in the more complicated tree or network structure.
  5. Data Manipulation Language: 
    • The possibility of responding to query by means of a language based on relational algebra and relational calculus 
    • Example: SQL is easy in the relational database approach.
Disadvantages :
  1. Performance: 
    • A major constraint and therefore disadvantage in the use of relational database system is machine performance. 
    • If the number of tables between which relationships to be established are large and the tables themselves effect the performance in responding to the sql queries.
  2. Physical Storage Consumption:
    • With an interactive system, for example an operation like join would depend upon the physical storage also. It is, therefore common in relational databases to tune the databases and in such a case the physical data layout would be chosen so as to give good performance in the most frequently run operations. 
    • Therefore would naturally result in the fact that the lays frequently run operations would tend to become even more shared.
  3. Slow extraction of meaning from data:  
    • if the data is naturally organized in a hierarchical manner and stored as such, the hierarchical approach may give quick meaning for that data.

Hierarchical Data Model

Hierarchical Data Model:


  1. A hierarchical database model is a data model in which the data is organized into a tree-like structure. 
  2. The data is stored as records which are connected to one another through links. 
  3. A record is a collection of fields, with each field containing only one value. 
Hierarchy is based on Parent-Child Relationship
  1. Parent-Child Relationship Type is basically 1:N relationship 
  2. The schema for a hierarchy has a single root 
  3. To represent M:N relationship in a hierarchical structure, we must allow duplication of child record instances.
Example For Hierarchical Data Model
Advantages:
  1. The model allows easy addition and deletion of new information.  
  2. Data at the top of the Hierarchy is very fast to access.   
  3. The model relates very well to natural hierarchies such as assembly plants and employee organization in corporations.  
  4. It relates well to anything that works through a one to many relationship. 
Disadvantages:
  1. It requires data to be repetitively stored in many different entities.  
  2. The database can be very slow when searching for information on the lower entities.  
  3. Searching for data requires the DBMS to run through the entire model from top to bottom until the required information is found, making queries very slow.  
  4. Can only model one to many relationships, many to many relationships are not supported.  


Tuesday, 5 January 2016

Logical Data Model

Logical Data Model

            In data architecture, a logical data model (LDM) is a type of data model showing a detailed representation of an organization's data,

(Enough notes for "logic data model" is provide in data model page)


Three models (for handling record-based data) are:

Logical data model is classified into three models. They are

  1. Hierarchical data model
  2. Network data model
  3. Relational data model
Details in separate blog