0% found this document useful (0 votes)
46 views13 pages

Dbms Notes

The document discusses database management systems and their components. It describes what a database is, the difference between data and information, and examples of database management systems like SQL, MySQL, Oracle etc. It also discusses the advantages of DBMS over file systems, applications of DBMS, data models, database languages, keys in DBMS, and other concepts related to DBMS.

Uploaded by

Saurabh Khare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views13 pages

Dbms Notes

The document discusses database management systems and their components. It describes what a database is, the difference between data and information, and examples of database management systems like SQL, MySQL, Oracle etc. It also discusses the advantages of DBMS over file systems, applications of DBMS, data models, database languages, keys in DBMS, and other concepts related to DBMS.

Uploaded by

Saurabh Khare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Database Management System

Data: Data is nothing but facts and statistics stored or free flowing over a
network, generally it's raw and unprocessed.
Information: Data becomes information when it is processed, turning it into
something meaningful.
Database: It is collection of related data stored electronically in a systematic
manner.
Database Management system: It is the system to manage database by the user.
Examples- SQL, MySQL, Oracle, IBMDB2 etc.

File System DBMS


User has to write the procedures for
managing the database. Not required
Files are unstructured data. Structured data
Data redundancy may found No data redundancy
Inconsistency and poor memory utilisation Data consistency and efficient memory utilisation.
Concurrent access of data has many Concurrent access of data using some form of
problem. locking

Application of DBMS: Telecom (customer details, network uses), Banking


system (customer info, credit card details), Airlines, etc.
Characteristics of DBMS:
Data stored into Tables: Data is never directly stored into the database. Data is
stored into tables, created inside the database.
Reduced Redundancy:
Data Consistency: On Live data, i.e. data that is being continuously updated and
added by multiple users at the same times, maintaining the consistency of data
can become a challenge. But DBMS handles it all by itself.
Query Language: DBMS provides users with a simple Query language, using
which data can be easily fetched, inserted, deleted and updated in a database.
Abstraction of Data: Hiding irrelevant details from user and providing abstract
view of data to users, helps in easy and efficient user-database interaction.

User Interaction with


database., Topmost
Level

What data is stored.


Programmers and administrator
works at this level.

How data is actually stored


in database. Lowest level.

Note: Design of database is called the Schema. It is written in DDL. It is of 3


types. a. Physical Schema b. Logical Schema c. View Schema
Instance: Data stored or value of variable in database at a particular moment of
time is called instance of database.

4 Types of Data Model:


Data Model is the modeling of the data description, data semantics, and
consistency constraints of the data. It provides the conceptual tools for describing
the design of a database at each level of data abstraction.
1. Hierarchical DBMS: Tree Like Structure. Data is Stored Hierarchically (top
down or bottom up) format. Data is represented using a parent-child relationship.
Where parent may have many children, but children have only one parent.
2. Network Model: Each child has multiple parents. i.e. Many to Many
relationships.

3**. Relational Model(RDBMS): Most Popular and easiest one. Based on


normalizing data in the rows and columns of the tables.
SQL, MS SQL Server, IBM DB2, ORACLE, My-SQL, and Microsoft Access
are based on RDBMS.
Table is also called relation.
Row--- Record
Column---- Attribute
Tuple—single row of Table
Degree—Total no. of columns or attributes.
Cardinality --- Total no. of rows or tuples.
Domain: a set of atomic values allowed for an attribute. Examples- Emp_name
should be string, Emp_age should be in range between 10-65.
Relation Schema: A relation name R and list of attributes a1, a2, ….., an.
Eg. Student (Name, Roll_number, age, address, phone_no, Grade)
Creation of database

Creation of table
Rows, columns, tables

4. Entity- Relationship Model: It develops a conceptual design of a database


creation. Entity means any things or object. It is based on creation of relationship
between multiple entities. Example- For School database- Student is an entity for
Student (Name, Roll_number, age, address, phone_no, Grade) and Address can
be another entity for Address (City, Pincode, state, country).

ER Model

Entity Attributes Relation

Relationship:
1. One to One: A female can marry to one male vice versa.
2. One to many: A scientist can invent many inventions but an invention is done
by the only specific scientist.
3. Many to One: Student enrols for only one course but a course has many
students.
4. Many to Many: Employee and project relationship.
DBMS Languages***
1. DDL (Data Definition Language): Create, rename, Drop, Alter, Truncate, Comment.
It is used to define the database schema.
 Create: create database or Table (Column and types of data in column, size
of data) e.g. Roll_no int(3), Name varchar(20).
 Drop**: delete a whole database or just a table permanently.
e.g. Drop TABLE Class_VI, Drop DATABASE School
 Truncate: remove all the records from a table including all spaces.
 ALTER**: ( Add, modify) It is used to add, delete or modify columns in
the existing table. E.g. To add 2 columns Age and Course to table Student.
ALTER TABLE Student ADD ( Age number(3), course varchar(40))
 Comment: can be written in single line, multiple lines.
Note: Truncate preserves the structure of table for further use unlike drop table
where the table is deleted with its full structure.
2. DML (Data Manipulation Language): Select, Insert, Update, Delete
DML request data from DBMS by using application programs hence can be
embedded in programs.
 Select: fetch data from database and one or more than one tables.
e.g. select column_name_1, column_name_2, … from Table_name.
 Insert: insert new row in a table.
 Update: Update Employee-Set Emp_salary= 1000 Where EMP_Age> 25;
 Delete: delete existing records/ rows from a table. E.g. Delete from Student
where Name = “Ram” .
3. DCL (Data Control Language): deals with rights, permissions and other
controls of database. GRANT, REVOKE.
4. TCL (Transaction Control Language): Commit, Rollback, Set transaction.
Procedure for Database Access
Data Manager: It determines which physical record is asked by user and sends
request for specific physical record to File manager.
File Manager: It decides which physical block of secondary storage devices
contains the required record and sends the request for the appropriate block to the
disk manager.
Database Users:
1. Naïve Users: use easy to use menu; e.g. ATM
2. Sophisticated Users: They interact with the system by writing SQL queries
directly through the query processor without writing application programs.
3. Application Programmers: computer professionals who interact with system
through DML. They write application programs.
4. Specialized users: They are also sophisticated users who write specialized
database applications that do not fit into the traditional data processing
framework. Example: Expert System, Knowledge Based System, etc.
Database Administrator(DNA)**
administration and maintenance of database is taken care by DBA.
 Creating the schema
 Specifying integrity constraints
 Storage structure and access method definition
 Granting permission to other users.
 Monitoring performance
 Routine Maintenance
ACID Properties of DBMS: to maintain integrity of database.
A- Atomicity: A transaction is a single unit of operation. You either execute it
entirely or do not execute it at all. There cannot be partial execution.
C- Consistency: Once the transaction is executed, it should move from one
consistent state to another.
I- Isolation:
D:Durability: After successful completion of a transaction, the changes in the
database should persist. Even in the case of system failures.
Keys in DBMS***: A key is an attribute or set of attributes that uniquely
identifies any record (tuple) from the table. In the below table to identify specific
Neha we can use unique Emp_Id, Aadhar_no etc.

1. Super Key: A combination of all the possible attributes that can uniquely
identify the rows. Superset.

2. Candidate Key: A candidate key is a minimal super key or Super key with no
redundant attributes. It is defined as distinct set of attributes from which primary
key can be selected. Not allowed to be a null value.
3. Primary Key: It is one of the candidate key chosen by the database designer to
uniquely identify the tuple in the relation.
 Value never be null
 Value always be unique
 No updation possible for value
 A relation is allowed to have only one primary key.

4. Alternate Key: Out of all candidate keys, only one gets selected as primary key
and remaining keys are known as alternate keys.

5. Foreign Key: A foreign key is used to link two tables together. An attribute (or
set of attributes) in one table that refers to the primary key in another table.
The purpose of foreign key is to ensure referential integrity of data.
It can take only those values which are present in the primary key of the
referenced relation.
It can take null value or have a duplicate value.
Referenced table is also called Primary Table or Parent Table.
Referencing Table may be called as Foreign or Child table.
6. Composite key: A key that has more than one attributes is known as Composite/
compound key.

Data Dictionary:
It is used to store all the details of database like table names, name of all the fields,
width and types of all the fields etc. in a tabular format. It contains name and
description of each data element.
It is maintained and exclusively used by data administrator.
Integrity Constraint**:
Integrity constraints ensure that the data insertion, updating, and other processes
have to be performed in such a way that data integrity is not affected hence guard
against accidental damage to database.

1. Domain Constraint:

2. Entity Integrity Constraint:


Primary key value can’t be null. This is because the primary key value is used to
identify individual rows in relation and if the primary key has a null value, then
we can't identify those rows.
3. Referential Integrity Constraints:
In the Referential integrity constraints, if a foreign key in Table 1 refers to the
Primary Key of Table 2, then every value of the Foreign Key in Table 1 must be
null or be available in Table 2.

4. Key Constraints:
An entity set can have multiple keys, but out of which one key will be the primary
key. A primary key can contain only a unique and null value in the relational
table.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy