Explain different database models.

q)Explain different database models.


Database model:-A database model or database schema is the structure or format of a database, described in a formal language supported by the database management system.

There are many database models. Let's understand some of the models.

Hierarchical model:-
Hierarchical database is a model in which data is organized into a tree-like structure. In this,
  • Data is organized like a family tree or organization chart
  • The parent record can have multiple child records – child records can only have one parent
  • Pointers link each parent record with each child record
  • Complex and difficult to maintain
This structure allows one 1:N relationship between two types of data. This structure is very efficient to describe many relationships in the real world; recipes, table of contents, ordering of paragraphs/verses,

We can see here a parent node with many branches called children.Each child has their own record with furhher informations.In given diagram, the first record has name “Ram” with street “Baneshwor” and city named kathmandu. It is further linked to its balance id and amount. In same fashion all others records have, they all are related or linked to  their id and amount. We can see records’ arrangement in tree like format.
Advantages:-   1) easiest model of database.
                      2) Searching is fast if parent is known.
                      3) supports one to many relationship.
Disadvantages:        1) old and outdated one.
                            2) Can not handle many to many relationships.
                                3) More redundancy.
Network model:-The network model organizes data using two fundamental constructs, called records and sets.        The Network Model
  1. Data are represented by collections of records.
  2. Relationships among data are represented by links.
  3. Organization is that of an arbitrary graph.
  4. Figure  shows a sample network database that is the equivalent of the relational database of Figure ??

We have taken same example as mentioned above.but the records are arranged in graph like structure. In this we do not use concept of child /parent.In given diagram the records are linked to each other with a solid line as it is in hierarchical. Two records namely Ramesh and Hary are linked to two balance id and amounts.
Advantages:- 1) more flexible due to many to many relationship.
                    2) Reduction of redundancy.
                    3) Searching is very fast.
Disadvantages:-   1) very complex.
                                2) Needs long and complex programs.
                                3) Less security
Relational model: - Three key terms are used extensively in relational database models: relations, attributes, and domains. A relation is a table with columns and rows. The named columns of the relation are called attributes, and the domain is the set of values the attributes are allowed to take.
The basic data structure of the relational model is the table, where information about a particular entity is represented in columns and rows. Thus, the "relation" in "relational database" refers to the various tables in the database; a relation is a set of tuples.So,

Relational databases
  • Data is organized into two-dimensional tables, or relations
  • Each row is a tuple (record) and each column is an attribute (field)
  • A common field appears in more than one table and is used to establish relationships
  • Because of its power and flexibility, the relational database model is the predominant design approach

id no.
Rs. 900087
Rs. 65799
Rs. 5600
Rs. 65400

In this table we have used different concept like field (each column),record (each row). Each row gives us a complete information. If we have many tables then we relate them for data extractions,this is called relationship between tables.Apart from these, we also use other concept like,primary key,foreign key,Entity etc.

1 comment: