Database
A database is a structured collection of interrelated data
that is stored in a physical location with a specific name. A database can be a
Flat File Database, Relational Database, Distributed Databases etc. A Database
Management System is a system that helps us perform various operations on the
data that is stored in a database.
Database Schema
Databases are designed to offer an organized mechanism for
storing, managing, and retrieving information. A database schema defines the
objects that are represented in the database and the structural description of
the facts that are held in that database.
Database Models
A database model describes the database schema as per the stated
requirements. These models are also called data models. There are three types
of models. These are:
·
Relational Model
·
Hierarchical Model
·
Network Model
Relational Database Management System
A Relational Database Management System facilitates the
organization, storage, access, security, and integrity of data and eliminates
data redundancy. It stores the data in a set of tables each of which contains
a unique identifier. Typical examples of RDBMS software include Oracle,
Microsoft SQL Server, Sybase, PostgreSQL, MySQL, etc.
Normalization
Normalization may be defined as the process of designing the
structure of the database in a way which will reduce redundancy and facilitate
easy data manipulation and better performance. It is a process that breaks down
data into record groups for faster and more efficient data processing. The most
common forms of normalization applied to databases are called the normal forms.
Database normalization is available in the following four levels:
·
First Normal Form
·
Second Normal Form
·
Third Normal Form and
·
Boyce Codd Normal Form
Tuple
A tuple is a collection of one or more attributes. It is a
row of information in a database table that is constructed over a given
database schema. It should be noted that a tuple usually represents some object
and its associated data. Further, a relation is defined as a set of n-tuples.
Stored Procedure
A stored procedure is a group of SQL statements that are
stored in the database using a name such that these statements can be executed
as a group by the database server. It is a group of executable code associated
with a database which often facilitates common database operations. The use of
stored procedures helps reduce network traffic, simplifies data management, and
facilitates data security.
Indexes
In a relational database an index is a copy of part of a
table that is used to speed up data retrieval in a database.
Triggers
Database triggers are stored procedures that are implicitly
executed whenever an INSERT, UPDATE, or DELETE statement is issued against the
associated table. It is used to maintain referential integrity in the database
and may also be used to execute a stored procedure.
A trigger has basically the following three parts:
1.
A triggering event or statement
2.
A trigger restriction
3.
A trigger action
Database triggers are of the following types:
·
Row and Statement trigger
·
Before and After trigger
·
Instead Of trigger
Views
A view is a logical table that contains the result set of a query.
Unlike an ordinary table in the database, a view is a virtual table and its
contents change as and when the data in the database table changes.
Constraints
A constraint is used to restrict the type of data that can
be stored in a database table. Hence, they facilitate implementing business
rules into the database. A primary key constraint as an example, does not allow
any row to contain a duplicate value.
Relation
A relation is a link between two tables and is defined as a
set of tuples all of which have the same attributes. The following are the
types of relations that can exist:
·
One-to-many
·
Many-to-many
·
One-to-one
Table
A database table is a collection of rows and columns which describe
the necessary structure to store data pertaining to a specific entity.
Fields
A field is an attribute pertaining to an entity, and it is
organized as a column in a database table.
Primary Key
A primary key is responsible for uniquely identifying a
particular record belonging to a specific entity. It is the unique identifier
for each row of a database table.
Unique Key
A unique key is an attribute which is unique for that column
of the table. A unique key unlike a primary key may or may not be null. Note
that a primary key or candidate key should always be a unique key, but the
reverse is not always true.
Composite Key
A candidate key is a unique identifier that enforces the
rule that no tuple will be duplicated. A Composite key is composed of a number
of attributes that together maintain the uniqueness.
Foreign Key
A foreign key is a reference to another key in a different
table and is used to declare referential integrity constraints. These are
actually integrity constraints which enforce that the principle "value of
the attribute set is drawn from a candidate key in another relation."
Transaction
A transaction is a unit of statements that are guaranteed
either to be executed by the database server in whole or aborted altogether. A
transaction abides by the ACID (Atomicity, Consistency, Isolation and
Durability) property.
Replication
Replication is the process of synchronizing databases to
improve reliability, fault-tolerance, and database performance.
Clustering
Database clustering is one way of achieving higher
availability of a database. It is focused on moving the database execution
environment to another server in the cluster to address database server failure
issues.
Distributed Databases
A distributed database is a collection of one or more
logically interrelated databases that are distributed i.e., they are spread across
the network.
Object Oriented Databases
Object Oriented databases organize the attributes "of a
given object into a unit or template that can be stored or retrieved by its
natural name". Object Database Management Systems are designed to work
with Object Oriented Programming languages like C++, Java, C#, etc.
Data Description Language (DDL)
This is a language that is used to define data and their
relationships to other data in a database.
Data Manipulation Language (DML)
This is a 4 GL programming language that defines how to
manipulate the data that is stored in the database.