Data Models
Data Models
A database can be designed in different ways
depending on the data being stored.
This structure of database is known as data model
that describes the manner in which data will be
stored and retrieved.
A data model consists of components for describing
the data, relationships among them and the
constraints that hold data.
There are different data models
hierarchical data model
network data model
relational data model.
Hierarchical Data Model
In this model the data is organized into a tree like structure.
The data is stored in the form of records.
A record is a collection of fields and its data values.
All these records are linked to each other at various levels,
thereby forming a hierarchy.
Network Data Model
In this model, multiple records are linked to same
master file.
It is also considered as an inverted tree where
master is present in the bottom of the tree and the
branches contain information linked to the master.
RELATIONAL DATA
MODEL
Relational Data Model
Relational Data Model This data model is based on the
principle of setting relationships between two or
more tables of the same database.
It is the most commonly used database model.
Relational Database Model
The Relational Database Model was
proposed in 1970 by E. F. Codd.
Relational database model is the most
common type of database model.
The data elements are stored in different
tables made up of rows and columns.
The data in different tables are related
through the use of common fields.
So relations are set between tables based on
common fields.
That is why this model is termed as relational
database model.
Edgar
RDBMS – Relational Database
Management System
RDBMS use SQL as database query
language.
The most popular RDBMS are MS SQL
Server, DB2, Oracle, MS Access and
MySQL.
Relational database
terminology
Entity
It is a real world object about which
information is to be stored in a database.
For example, if we want to store
information about an entity Student in a
school
ATTRIBUTES
These details associated with the entity are
called attributes.
Each entity is a collection of these
attributes associated with it.
roll number, name, admission number, etc.,
are attributes associated with the entity
student.
These attributes are represented in the
form of columns.
Table
A table is a collection of logically related
records.
It is organised as a set of columns, and can
have any number of rows.
Field or Columns or attributes
A field is the smallest entity in the database.
Data values are stored in a database as fields.
A field holds the data values of one type of data.
A collection of fields make a record.
A collection of records make a table.
A collection of tables make a database.
A File is a collection of related records.
Data Values
Data values are the raw data represented in numeric, character or
alphanumeric form.
Record or Row
The data values for all the fields related to a person or object is called a
record.
It is presented as rows within a table.
RELATIONAL DATABASE
A relational database is a collection
of related tables.
Keys in DBMS
Primary key
Alternate key
Candidate key
Foreign key
CANDIDATE KEYS
All the field values that are eligible to be the primary key are the
candidate keys for that table.
Such fields can neither be left blank nor can have duplicate values.
PRIMARY KEY
A primary key or simply a key is a field that uniquely identifies a row in a
table.
The key identifier can be the value of a single column or of multiple
columns.
The primary key is a unique identifier for the table.
ALTERNATE KEYS
Out of the candidate keys, one or two are made as primary keys.
The others are the alternate keys.
Foreign Key
If a field or a combination of fields of one table can be used
to uniquely identify records of another table, then that
particular field is known as the foreign key.
This foreign key helps to build a relation between two tables.
Composite Primary Key
Combination of fields makes up the
Primary key.