SAD-Data Structure

Data are structured according to the data model. In this example sales items are  linked to the salesperson who sold them. The salesperson is called an entity and the item sold is also an entity. An entity is a conceptual representation of an object. Relationships between entities make up a data structure. A data model represents a data structure that is described to the DBMS in DDL.

Types of relationships:

Three types of relationships exist among entities: one-to-one, one-to-many, and many-to many relationships.

1. A one-to-one(1:1) relationship is an association between two entities. For ex an  employee has one social security number.

2. A one-to-many (1:m) relationship describes an entity that may have two or more entities related to it. For ex a father may have many children, and a employee may have many skills.

3. A many-to-many (M:M) relationship describes entities that may have many relationships in both directions. For ex , children may have many toys and students may have many courses.

Types of data structure:

Data structuring determines whether the system can create 1:1,1:M,M:M relationships among entities. Although all DBMSs have a common approach to data management, they differ in the way they structure data. There are three types of data structure:

1. Hierarchical
2. Network
3. Relational

1. Hierarchical structuring: Hierarchical (also called tree) structuring specifies that an entity can have no more than one owing entity; that is, we can establish a 1:1 or a 1:M relationship. The owing entity is called the parent, the owned entity is called the child. A parent with no owners is called the root. There is only one root in a hierarchical model. A parent can have many children (1:M) whereas a child can have only one parent. Elements at the ends of the branches with no children are called leaves. Trees are normally drawn upside down, with the root at the top and leaves at the bottom. It is easy to design and understand.

Example: Customer checking account.

2.Network structuring: A network allows 1:1, 1:M or M:M relationships among entities. A network structure reflects the real world, although a program structure can become complex. The solution is to separate the network into several hierarchies with duplicates. This simplifies the relationship to no more complex than 1:M. A hierarchy then becomes a subview of the network structure.

3. Relational structuring. In relational structuring all data and relationships are represented in a flat, two- dimensional table called a relation. A relation is equivalent to a file, where each line represents a record. A relational DBMS has several features.

1.It allows the user to update (add, modify, delete) the table’s contents. Any position can be changed.
2.It provides inquiry capabilities against a label.
3.Two or more tables can be merged to from one relation. Unlike hierarchical or network structuring where all relationships are predefined a relational DBMS develops new relations on user commands.

It is simpler to construct

Entities and attributes:

An entity is used by the user to store or collect data. It is also called a data aggregate.  Attributes describe an entity. They take up a unique value.  A key is a unique identifier of the entity.
 Example:


Share this article :
 
Copyright © 2012. Best Online Tutorials | Source codes | Programming Languages - All Rights Reserved