Saturday 1 March 2014

Generalization in data base management | Database management


GENERALIZATION

It is the form of abstraction that specifies that 2 or more entities that share common attributes can be generalized into a higher level entity time called a super type or a generic entity. The lower levels of entities become the sub type to the super type.It is used to emphasis the similarities among the lower level entity sets and to hide the differences.It makes the ER diagram simpler because shared attributes are not repeated. 
           A generalization is an extension of the concept to less-specific criteria. It is a foundation element of logic and human reasoning.
         Generalizations posit the existence of a domain or set of elements, as well as one or more common characteristics shared by those elements. As such, they are the essential basis of all valid deductive inferences. The process of verification is necessary to determine whether a generalization holds true for any given situation.

EXAMPLE:-There are 2 department(ENGG,MGMT) which is generalized into DEPT and the attributes which are common between these two are placed together.


                                            (GENERALIZATION)

Object based data model | Data model


OBJECT BASED DATA MODEL

DEFINITION:-
It uses the concept such as entities ,attributes and relationship.

What is an entity?- An Entity is the distinct object in the organization and that is to be represented in database.There are 2 types of entities.Strong and weak entity.Entity type that do not have any key attributes are known as weak entity type but regular entity type that have key attributes are known as strong entity.

What is an attribute?- An attribute is that which describe some aspect of the object that we wish to record.
Types of attributes:-
1. Single value attributes:- These are the attribute that have single value.
2. Composite attributes:- It composed of multiple components.e.g

3. Simple attributes:- It is an attribute that composed of a single component with an independent existence. These attributes can't be further sub-divided.e.g age,rollno.
4. Multi-valued attributes: It can hold multiple value for a single attribute. e.g phone no

TYPES OF OBJECT BASED DATA MODELS:-There are 4 types of Object based data models:-
1.) ER(entity relationship) model
2.) Object oriented ER model
3.) Semantic model
4.) Functional model

1.) ER MODEL(entity relationship model)(Top-down approach):-It is the graphical technique i.e. used to convert the requirements of the system to a graphical representation for easy understanding.It is a conceptual model that used the objects as entity, attributes and relationships.Its basic component is ER diagram.It is simple and easy to understand .It can be easily converted to other models.
ER NOTATIONS:-


HOW TO DESIGN AN ER DIAGRAM:- EG. BANKING SYSTEM


2.) OBJECT ORIENTED ER MODEL:-The object oriented data model extends the definition of an entity to include,not only the attributes that describe the state of the object but also the actions that are associated with the object,that is its behavior.The object is said to encapsulate both state and behavior.

3.) SEMANTIC MODEL:- It is used to express greater inter-dependencies among the entities of interest.These inter-dependencies enable the model to represent semantics of the data in DB.This class of data models is influenced by the work of artificial intelligence researches semantic data model. It is developed to organize and represent knowledge not data. In coming times,DBMS will be fully partially intelligent

4.)FUNCTIONAL MODEL:-It describes computation within system(How output is derived from input).

Relationship and their types | Data models


RELATIONSHIPS AND RELATIONSHIP SETS

INTRODUCTION OF RELATIONSHIPS-

After two or more entities are identified and defined with attributes, the participants determine if a relationship exists between the entities. A relationship is any association,linkage, or connection between the entities of interest to the business; it is a two-directional, significant association between two entities, or between an entity and itself.Each relationship has a name, an optional (optional or mandatory), and a degree (how many).

A relationship is described in real terms.Relationship represents an association between two or more entities.Entities enrolled in a relationship are called its participants

EXAMPLE-   Employees are assigned to projects
                    Projects have sub-tasks
                    Departments manage one or more projects

TYPES OF RELATIONS-
1.) 1:M(One to many)-In a one-to-many relationship, each row in the related to table can be related to many rows in the relating table. This allows frequently used information to be saved only once in a table and referenced many times in all other tables.
EXAMPLE-In class there is only one faculty member and there are number of children. This is an example of one to many relationship.


                                     (ONE-MANY RELATIONSHIP)

2.)M:M (Many to many relationship)-A many-to-many relationship refers to a relationship between tables in a database when a parent row in one table contains several child rows in the second table, and vice versa. Many-to-many relationships are often tricky to represent.
EXAMPLE- There are so many skills of a person and its vice versa.

                                      (MANY-MANY RELATIONSHIP)

 3.) M:1(Many to one relationship)- A many-to-one relationship is where one entity (typically a column or set of columns) contains values that refer to another entity (a column or set of columns) that has unique values. In relational databases, these many-to-one relationships are often enforced by foreign key/primary key relationships, and the relationships typically are between fact and dimension tables and between levels in a hierarchy.
EXAMPLE- In any company there are no of stores and for one store there should be one head employee.

4.) 1:1(One to one relationship)-In a one-to-one relationship, each row in a table is related to a single row in another table.
EXAMPLE- 
In a warehouse application a storage-bin table might have a one-to-one relationship with a widget table. This application would model a physical warehouse where each storage bin contains one type of widget and each widget resides in one storage bin.

Network model and their Advantages and Disadvantages | Data models


NETWORK MODEL

INTRODUCTION-
The network model is a database model conceived as a flexible way of representing objects and their relationships. Its distinguishing feature is that the schema, viewed as a graph in which object types are nodes and relationship types are arcs, is not restricted to being a hierarchy or lattice.
The network model replaces the hierarchical model with a graph thus allowing more general connections among the nodes.The main difference of the network model from the hierarchical model is its ability to handle many to many relationships.In other words it allow a record to have more than one parent.
EXAMPLE-



ADVANTAGES OF NETWORK MODEL-
The major advantage of network model are-
1.) Conceptual simplicity-Just like the hierarchical model,the network model is also conceptually simple and easy to design.
2.) Capability to handle more relationship types-The network model can handle the one to many and many to many relationships which is real help in modeling the real life situations.
3.) Ease of data access-The data access is easier and flexible than the hierarchical model.
4.) Data integrity- The network model does not allow a member to exist without an owner.
5.) Data independence- The network model is better than the hierarchical model in isolating the programs from the complex physical storage details.
6.) Database standards

DIS-ADVANTAGE OF NETWORK MODEL-
1.) System complexity- All the records are maintained using pointers and hence the whole database structure becomes very complex.

2.) Operational Anomalies- The insertion,deletion and updating operations of any record require large number of pointers adjustments.
3.) Absence of structural independence-structural changes to the database is very difficult.

Network model and its Advantages | data models


NETWORK MODEL

INTRODUCTION-
The network model is a database model conceived as a flexible way of representing objects and their relationships. Its distinguishing feature is that the schema, viewed as a graph in which object types are nodes and relationship types are arcs, is not restricted to being a hierarchy or lattice.
                The network model replaces the hierarchical model with a graph thus allowing more general connections among the nodes.The main difference of the network model from the hierarchical model is its ability to handle many to many relationships.In other words it allow a record to have more than one parent.
EXAMPLE-



ADVANTAGES OF NETWORK MODEL-

The major advantage of network model are-
1.) Conceptual simplicity-Just like the hierarchical model,the network model is also conceptually simple and easy to design.
2.) Capability to handle more relationship types-The network model can handle the one to many and many to many relationships which is real help in modeling the real life situations.
3.) Ease of data access-The data access is easier and flexible than the hierarchical model.
4.) Data integrity- The network model does not allow a member to exist without an owner.
5.) Data independence- The network model is better than the hierarchical model in isolating the programs from the complex physical storage details.
6.) Database standards

DIS-ADVANTAGE OF NETWORK MODEL-

1.) System complexity- All the records are maintained using pointers and hence the whole database structure becomes very complex.
2.) Operational Anomalies- The insertion,deletion and updating operations of any record require large number of pointers adjustments.
3.) Absence of structural independence-structural changes to the database is very difficult.

Relational model | Data models


RELATIONAL MODEL

INTRODUCTION-
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.

CHARACTERISTICS-
Characteristics of relational database are:-
1.) All data is conceptually represented as an orderly arrangement of data into rows and column called a relation or table.
2.) All the values are scaler i.e. at any given row or column position there is one and only one value.
3.) All operations are performed on the entire relation and the result is an entire relation.

BASIC TERMINOLOGY OF RELATIONAL DATABASE-  

1.) TUPLE OF A RELATION-Each row in a table is known as tuple.
2.) CARDINALITY OF A RELATION-  It is the no of tuples in the relation.
3.) DEGREE OF A RELATION-No of columns is known as degree of a relation.
4.) DOMAIN OF A RELATION-It defines the kind of data represented by the attribute.It is the set of all possible values that an attribute may contain.
5.) BODY OF THE RELATION-It consists of an unordered set of 0 or more tuples.

EXAMPLE:- Consider a table


1.) TUPLE OF A RELATION 8
2.) CARDINALITY OF A RELATION-  8
3.) DEGREE OF A RELATION5
4.) DOMAIN OF A RELATION- All the data entered in the table is the domain of a relation.

KEYS OF A RELATION-
1.) PRIMARY KEY- It is the key that uniquely identifies a record. It doesn't have null values.

2.) FOREIGN KEY- It refers to the primary key of some other table.It permits only those values which appear in the primary key of the table to which it refers.

Hierarchical model (Record based data model) | Data models


HIERARCHICAL MODEL(RECORD BASED DATA MODEL)

INTRODUCTION-
It is developed to manage large amounts of data for complex manufacturing projects.
                             (STRUCTURE OF HIERARCHICAL MODEL)

This structure contains levels or segments.The top layer is known as the parent of the segment .Root segment is the parent of level 1 segment.This model defects a set of one to many relationship between parent and children segments.E.G COLLEGE STRUCTURE


ADVANTAGES OF HIERARCHICAL MODEL:-
1.) It provides simplicity and it is easy to design.
2.) It also provide data integrity.Since, it is based on parent-child relationship.So, there is always a link between these segments.

DRAWBACKS OF HIERARCHICAL MODEL:-
1.) There exist operational anomalies in this model.
2.) Implementation Complexity
3.) It is easy to design but very difficult to implement.
4.) Database Management System-If you make any change in the database structure then you need to make all the necessary changes in all the application program that access the database.

Data models and their types | database managenent system


DATA MODELS

INTRODUCTION:-
It can be  defined as an integrated collection of concepts for describing and manipulating data,relationship between data and the constrains of the data in any organization.
It consists of three components:-
1.)Structured part:- It consist of set of rules according to which database can be connected.
2.) Manipulative part:- It defines the types of operations that are allowed on data.
3.) Set of integrity rules:-It ensures that the data is accurate.

PURPOSE OF DATA MODEL:- Purpose of data model is to represent the data and to make it understandable.

TYPES OF DATA MODEL:-
There are 3 types of data models:-
1.) Object based data models
2.) Physical data models
3.) Record based

1.) OBJECT BASED DATA MODELS:-It uses the concepts such as entities,attributes and relationship.It is of further 4 types:-
1.) ER(entity relationship)model
2.) Object oriented ER model
3.) Semantic model
4.) Functional model

2.) PHYSICAL DATA MODEL:-It describes how the data is stored in the computer representing the information such as record structure ,record modeling and access paths.

3.) RECORD BASED DATA MODEL:- These are used in describing the data at logical and view levels.These are used to specify the overall logical structure of the database.Record database models are of 3 types which are:-
1.) Hierarchical model
2.) Network model
3.) Relational model