1. DBMS
DATABASE MANAGEMENT SYSTEM
DATA: known facts that can be recorded & that have implicit meaning.
DATABASE: Collection of related data.
DBMS: organization or arrangement of data through a software .
A dbms is a collection of programs that enables users to create & maintain a database.
It stores data, in such a way which is easier to retrieve, manipulate and helps to produce
information.
It has a largely varying size.
REAL LIFE APPLICATIONS:
Computerized library systems
Automated teller machines
Flight reservation systems
Computerized parts inventory systems
What is defining a database?
It involves the data types & DS & constraints of the data to be stored in the database.
A database may contain info. About the following:
1. Entities
2. Relationship between entities
{A student entity may contain name, roll no, branch}
DBMS VS FILE SYSTEM
Advantages of dbms over file system:
1. Self-describing nature of dbms
2. Controlling redundancy
3. Support of multiple views of data
4. Insulation(to secure) of data & programs
2. ADVANTAGES OF A DBMS
1. Data independence: Application programs should be as independent as possible from
details of data representation and storage. The DBMS can provide an abstract view of
the data to insulate application code from such details
2. Efficient data access: A DBMS utilizes a variety of sophisticated techniques to store
and retrieve data efficiently. This feature is especially important if the data is stored on
external storage devices.
3. Data integrity and security: If data is always accessed through the DBMS, the
DBMS can enforce integrity constraints on the data.
4. Concurrent access and crash recovery: A DBMS schedules concurrent accesses to the
data in such a manner that users can think of the data as being accessed by only one user
at a time. Further, the DBMS protects users from the effects of system failures.
Controlling Redundancy
Restricting Unauthorized Access
Providing Persistent Storage for Program Objects and Data Structures
Permitting Inferencing and Actions Using Rules
Providing Multiple User Interfaces
Representing Complex Relationships Among Data
Enforcing Integrity Constraints
Providing Backup and Recovery
The goal of a DBMS is to provide an environment that is both convenient and efficient to
use in
Retrieving information from the database
Storing information into the database
DISADVANTAGE OF DATABASE:
High cost
Expertized training
Huge manpower
It occupies large amount of disk space
Complex in nature compared to file system
3. DATABASE SCHEMAS:
Database schema is the skeleton of database
A database schema defines its entities and the relationship among them. Database
schema is a descriptive detail of the database, which can be depicted by means of
schema diagrams. All these activities are done by database designer to help
programmers in order to give some ease of understanding all aspect of database.
Database schemas can be divided into 2 categories:
1. Physical Database Schema: It defines the how data will be stored in secondary
storage etc.
2. Logical Database Schema: It defines tables, views and integrity constraints etc.
E-R MODEL:
ENTITY RELATIONSHIP MODEL
It defines the conceptual view of database.
5. E-R MODEL
Entity
Entity in a school database
An entity set is a collection of similar types of entities. Entity set may contain entities with
attribute sharing similar values.
Attributes:
Entities are represented by means of their properties, called attributes. All attributes have
values. For example, a student entity may have name, class, age as attributes.
SQL:
SQL (Structured Query Language) is used to perform operations on the records stored in
database such as updating records, deleting records, creating and modifying tables, views
etc.
It is designed for managing data in a relational database management system (RDBMS).
It depends on relational algebra and tuple relational calculus.
Why SQL is required
SQL is required:
To create new databases, tables and views
To insert records in a database
To update records in a database
To delete records from a database
To retrieve data from a database
6. WHAT SQL DOES:
With SQL, we can query our database in a numbers of ways, using English-like
statements.
With SQL, user can access data from relational database management system.
USES OF SQL:
It allows user to describe the data.
It allows user to define the data in database and manipulate it when needed.
It allows user to create and drop database and table.
It allows user to create view, stored procedure, function in a database.
It allows user to set permission on tables, procedure and view.
SUBSETS OF SQL:
1. Data definition language (DDL)
2. Data manipulation language (DML)
3. Data control language (DCL)
DDL:
allows you to CREATE, ALTER and DELETE database objects such as schema, tables, view,
sequence etc.
DML:
It is used to perform following operations.
• Insert data into database
• Retrieve data from the database
• Update data in the database
• Delete data from the database
DCL:
allows you to control access to the database. It includes two commands GRANT and
REVOKE.
GRANT: to grant specific user to perform specific task.
REVOKE: to cancel previously denied or granted permissions
TRIGGER;
Trigger allows you to execute a batch of SQL code when an insert, update or delete
command is executed against a specific table.
7. Actually triggers are special type of stored procedures that are defined to execute
automatically in place or after data modifications