Sunteți pe pagina 1din 23

DATA MODEL

WEEK 1-2

DATA MODEL
Data modeling, the first step in designing a database, refers to the process of
creating a specific data model for a determined problem.
A data model is a relatively simple representation, usually graphical, of more
complex real-world data structures.
main function : to help understand the complexities of the real-world environment
and to represent data and to make the data understandable. If it does this, then it
can be easily used to design a database
provide the basic concepts and notations that will allow database designers and
end-users accurately to communicate their understanding of the organizational
data.

DATA MODEL

HIERARCHICAL MODEL
was developed in the 1960s to manage large amounts of data for complex
manufacturing projects such as the Apollo rocket that landed on the moon in 1969.
Characteristics :
logical structure is represented by an upside-down tree.
The hierarchical structure contains levels, or segments. A segment is the equivalent of
a file systems record type. Within the hierarchy, a higher layer is perceived as the
parent of the segment directly beneath it, which is called the child.
structure implies that a record can have repeating information, generally in the child data
segments
The hierarchical model depicts a set of one-to-many (1:M) relationships between a
parent and its children segments. (Each parent can have many children, but each child
has only one parent.)

HIERARCHICAL MODEL

HIERARCHICAL MODEL

HIERARCHICAL MODEL
Advantages
The model allows easy addition and deletion of new information
Data at the top of the Hierarchy is very fast to access.
. The model relates very well to natural hierarchies such as assembly plants and
employee organization in corporations. It relates well to anything that works through a
one to many relationship.

Disadvantages
It requires data to be repetitively stored in many different entities.
. The database can be very slow when searching for information on the lower entities
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.
. Can only model one to many relationships, many to many relationships are not
supported

NETWORK MODEL
represent complex data relationships more effectively than the hierarchical model
and to improve database performance
Some data were more naturally modeled with more than one parent per child. So,
the network model permitted the modeling of many-to-many relationships in data.
Additional info :
The Network Database Model was invented by Charles Bachman in 1969 to
enhance the existing hierarchical database model.
He created this model to increase the flexibility and make it less difficult to
understand. To make this change Bachman developed the Network Database
Model to allow multiple records to be linked to the same owner file creating a manyto-many relationship rather than a one-to-man

NETWORK MODEL

NETWORK MODEL

NETWORK MODEL
Advantages :
Conceptual simplicity: Just like the hierarchical model, the network model IS also
conceptually simple and easy to design.
Capability to handle more relationship types: The network model can handle the one
to- many (l:N) and many to many (N:N) relationships, which is a real help in modeling
the real life situations.
Data Integrity: The network model does not allow a member to exist without an owner.
Thus, a user must first define the owner record and then the member record. This
ensures the data integrity

Disadvantages :
System complexity: The whole of the database structure can become more complex
than ever..

RELATIONAL DATA MODEL


The relational data model is based on the concept of mathematical relations.
In the relational model, data and relationships are represented as tables, each of
which has a number of columns with a unique name.

RELATIONAL DATA MODEL


A relation has the following properties:
the relation has a name that is distinct from all other relation names in the relational
schema;
each cell of the relation contains exactly one atomic (single) value;
each attribute has a distinct name;
the values of an attribute are all from the same domain;
each tuple is distinct; there are no duplicate tuples;
the order of attributes has no signicance;
the order of tuples has no signicance, theoretically. (However, in practice, the order
may affect the efciency of accessing tuples.)

RELATIONAL DATA MODEL

RELATIONAL DATA MODEL

RELATIONAL DATA MODEL


Advantages:
Conceptual Simplicity: We have seen that both the hierarchical and network
models are conceptually simple, but relational model is simpler than both of those
two.
. Ease of use: The revision of any information as tables consisting of rows and
columns is much easier to understand .
Flexibility: Different tables from which information has to be linked and extracted
can be easily manipulated by operators such as project and join to give information
in the form in which it is desired. .
.

RELATIONAL DATA MODEL


Disadvantages:
Hardware overheads: relational database systems hide the implementation
complexities and the physical data storage details from the user. For doing this, the
relational database system need more powerful hardware computers and data storage
devices.
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

DBMS LANGUAGE
DATA DEFINITION LANGUAGE (DDL)
DATA MANIPULATION LANGUAGE (DML)

DATA DEFINITION LANGUAGE


Used by the DBA and database designers to specify the conceptual schema of a
database.
To create the structure of the database
it was used to refer to a subset of Structured Query Language (SQL) for creating
tables and constraints.
Example :
CREATE STATEMENT : database, table
ALTER-To modify an existing database object.
DROP - To destroy an existing database, table,

DATA MANIPULATION LANGUAGE


Used to specify database retrievals and updates.
A popular data manipulation language is that of Structured Query Language(SQL),
which is used to retrieve and manipulate data in a relational database.
DML statements, namely:

SELECT to query data in the database;


INSERT to insert data into a table;
UPDATE to update data in a table;
DELETE to delete data from a table.

DATA INTEGRITY
The accuracy and consistency of stored data, indicated by an absence of any alteration in data between
two updates of a data records.
Integrity is usually expressed in terms of constraints, which are the consistency rules that the database
is not permitted to violate.
Enforcing data integrity ensures the quality of the data in the database.
For example,
if an employee is entered with an employee_id value of 123, the database should not allow another
employee to have an ID with the same value.
If an employee_rating column intended to have values ranging from 1 to 5, the database should not accept
a value of 6. If the table has a dept_id column that stores the department number for the employee, the
database should allow only values that are valid for the department numbers in the company.

DATA INTEGRITY
Data integrity is normally enforced in a database system by a series of integrity constraints or
rules.
Data integrity falls into these categories:
o Entity integrity
-concerns the concept of a primary key.
-Entity integrity is an integrity rule which states that every table must have a
primary key and that the column or columns chosen to be the primary key
should be unique and not null.
o Referential integrity
- concerns the concept of a foreign key.
-The referential integrity rule states that any foreign key value can only be in one of
two states. The usual state of affairs is that the foreign key value refers to a primary
key value of some table in the database.

DATA INTEGRITY

S-ar putea să vă placă și