Database Concepts
INTRODUCTION
Database is collection of interrelated data and database
system is basically a computer based record keeping system.
It contains the information about one particular enterprise.
It maintains any information that may be necessary to the
decision making process involved in the management of that
organisation.
Database Concepts
WHY DATABASE?
A typical file processing system suffers from some major
limitations like,
✓Data Redundancy ✓Un-standardized Data
✓Data Inconsistency ✓Insecure Data
✓Un-sharable Data ✓Incorrect Data
On the other hand, a database system overcomes all
these limitations and ensures continues efficiency.
Database Concepts
ADVANTAGES OF DATABASE
The advantages provided by a database system are :
1. Reduced redundancy
2. Controlled data inconsistency
3. Shared Data
4. Standardized Data
5. Secured Data
6. Integrated Data
Database Concepts
ADVANTAGES OF DATABASE
1. Reduced redundancy:
Database redundancy means duplication of data. Non-
database systems maintain separate copy of data for each
application.
For example:
In college, student records are maintained and hostel also
maintains the student records for those students who live in
hostel. Though the records of hosteller students are already
being maintained by the college, the hostel keeps separate
copy of it. But this duplication of data leads to inconsistency
or incorrect data.
Database Concepts
ADVANTAGES OF DATABASE
2. Controlled Data Inconsistency:
When the redundancy is not controlled, there may be
occasions on which two entries about the same data do
not agree(that is one of them stores updated information
and the other does not.) at such times, database is said to
be inconsistence.
By controlling redundancy, the inconsistency is also
controlled. The database ensures any change is made to
either of the two entries is automatically made to the other.
This process is known as propagating updates.
Database Concepts
ADVANTAGES OF DATABASE
3. Shared Data
Sharing of data mean that individual piece of data in the
database may be shared among several different users, in
the sense that each of those users may have access to the
same piece of data and each of them may use it for
different purposes.
Database Concepts
ADVANTAGES OF DATABASE
4. Standardized Data
The database management systems can ensure that all
the data (that is stored centrally) follow the applicable
standards. There may be certain standards laid by the
company or organization using the database.
Similarly, there may be national and or international
standards. Standardizing stored data formats is particularly
desirable as an aid to data interchange or migration
between systems.
Database Concepts
ADVANTAGES OF DATABASE
5. Secured Data
A database management system ensures data security
and privacy by ensuring that the only means of access is
through proper channel and also by carrying out
authorization checks whenever access to sensitive data is
attempted.
Data Security: Data security refers to protection of data against
accidental or intentional disclosure to unauthorized persons, or
unauthorized modification or destructions.
Privacy of Data: it refers to the rights of individuals and
organizations to determine for themselves when, how and what
extent information about them is to be transmitted to others
Database Concepts
ADVANTAGES OF DATABASE
6. Integrated Data
When database contains data employed by many different
users it is important that association between data items
not to be destroyed. Hardware failures and various types
of accidents will occur occasionally. The storage of data
and its updation, and insertion procedures defined by the
database, are such that the system can easily recover
from these circumstances without harm to the data.
The database management system designs certain
integrity checks to ensure that data values confirm to some
specified rules. For example date cant be like 25/25/12; it
is invalid date.
Database Concepts
DATA MODELS
A database model is a specification describing how a
database is structured and used.
A data model organizes data elements and
standardizes how the data elements relate to one
another.
Data model tells how the logical structure of a database
is modelled. Data Models are fundamental entities to
introduce abstraction in DBMS. Data models define
how data is connected to each other and how it will be
processed and stored inside the system.
Database Concepts
DATA MODELS
There are three types of Data Models,
✓ Relational Model
✓ Network Model
✓ Hierarchical Model
Database Concepts
DATA MODELS
RELATIONAL MODEL
Relational data model is the primary data model, which is used
widely around the world for data storage and processing. This
model is simple and have all the properties and capabilities
required to process data with storage efficiency.
In the relational model, all data must be stored in relations (tables),
and each relation consists of rows and columns. Each relation must
have a header and body. The header is simply the list of columns in
the relation. The body is the set of data that actually populates the
relation, organized into rows. You can extrapolate (extend) that the
junction of one column and one row will result in a unique value -
this value is called a tuple.
Database Concepts
DATA MODELS
RELATIONAL MODEL
The second major characteristic of the relational model is the
usage of keys. These are specially designated columns within a
relation, used to order data or relate data to other relations. One of
the most important keys is the primary key, which is used to
uniquely identify each row of data. To make querying for data
easier, most relational databases go further and physically order
the data by the primary key. Foreign keys relate data in one relation
to the primary key of another relation.
Database Concepts
DATA MODELS
RELATIONAL MODEL – AN EXAMPLE
Database Concepts
DATA MODELS
RELATIONAL MODEL - CONCEPT
Tables: In relation data model, relations are saved in the format of
Tables. This format stores the relation among entities. A table has rows
and columns, where rows represent records and columns represents
the attributes.
Tuple: A single row of a table, which contains a single record for that
relation is called a tuple.
Attribute : columns are referred as attributes.
Domain: A pool of values from which the actual values appearing in a
given column are drawn.
Degree is the total number of attributes(columns) in a
relation (table).
Cardinality is the total number tuples (rows) in a
relation (table). While finding the cardinality, the first
row which contains the column heading is excluded.
Database Concepts
DATA MODELS
RELATIONAL MODEL - CONCEPT
What does Primary Key mean?
A primary key is a special relational database table column (or
combination of columns) designated to uniquely identify all table
records.
A primary key’s main features are:
✓It must contain a unique value for each row of data.
✓It cannot contain null values.
A primary key is either an existing table column or a column that is
specifically generated by the database according to a defined
sequence.
Database Concepts
DATA MODELS
RELATIONAL MODEL - CONCEPT
PRMARY KEY - TABLE - CUSTOMERS
primary key field
Primary key is a unique identifier of records in a table.
Primary key values may be generated manually or automatically.
Database Concepts
DATA MODELS
RELATIONAL MODEL - CONCEPT
What does Foreign Key mean?
A foreign key (REFERENTIAL INTEGRITY) is a column or group of
columns in a relational database table that provides a link between data
in two tables. It acts as a cross-reference between tables because it
references the primary key of another table, thereby establishing a link
between them.
The majority of tables in a relational database system adhere to the
foreign key concept. In complex databases and data warehouses, data
in a domain must be added across multiple tables, thus maintaining a
relationship between them. The concept of referential integrity is
derived from foreign key theory. Foreign keys and their implementation
are more complex than primary keys.
Primary key field
Parent table
Directors
Relationship
Movies
Child table
Foreign key field
Database Concepts
DATA MODELS
RELATIONAL MODEL - CONCEPT
What does Candidate Key mean?
All the attribute combinations inside a relation that can serve
primary key are candidate keys as they are candidates for the
primary key position.
What does Alternate Key mean?
A candidate key that is not the primary key is called alternate
key.