Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
16 views19 pages

Dbms Module 1 Notes

Uploaded by

premlakshmi nair
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)
16 views19 pages

Dbms Module 1 Notes

Uploaded by

premlakshmi nair
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/ 19

DEPARTMENT OF COMPUTER ENGINEERING

SEMESTER-3
3133- DATABASE MANAGEMENT SYSTEM
MODULE 1 NOTES

Data

Data is a raw and unorganized fact that required to be processed to make it meaningful.
Information
Information is a set of data which is processed in a meaningful way according to the given
requirement.

Database

 The database is a collection of inter-related data which is used to retrieve, insert and
delete the data efficiently.
 For example: The college Database organizes the data about the admin, staff,
students and faculty etc.
 Using the database, we can easily retrieve, insert, and delete the information.
Database Management System

 Database management system is a software which is used to manage the database.


 For example: MySQL, Oracle, etc are a very popular commercial database which is
used in different applications.
 DBMS provides an interface to perform various operations like database creation,
storing data in it, updating data, creating a table in the database etc.

Database system
 The data base and the DBMS software are collectively known as database system.
Characteristics of DBMS

 It can provide a clear and logical view of the process that manipulates data.
 DBMS contains automatic backup and recovery procedures.
 It can reduce the complex relationship between data.
 It is used to support manipulation and processing of data.
 It is used to provide security of data.
DBMS is used in following sectors

 Banking and finance


 Universities
 Airlines
 Telecommunication
 Manufacturing
 HR Management
DATABASE USERS
1) NAIVE USERS
 Unsophisticated users who interact with the system by using predefined user
interfaces, such as web or mobile applications.
 The user interface for naive users is a forms interface, where the user can fill
in appropriate fields of the form.
 Naive users view report generated from the database.
2) APPLICATION PROGRAMMERS
 Computer professionals who write application programs.
 Choose from many tools to develop user interface.
3) SOPHISTICATED USERS
 Interact with the system without writing programs.
 They form their request either using a database query language or by using
tools such as data analysis software.
 Analysts who submit queries to explore data in the database falls in this
category
4) DATABASE ADMINISTRATOR
 A person who has central control over the system is called a database
administrator (DBA).
The functions of DBA include:

 Schema definition.
 Storage structure and access method definition
 Granting of authorization for data access
 Routine Maintenance anting of authorization for data access.
DATABASE MODEL
A database model defines the logical design and structure of a database and defines how
data will be stored, accessed and updated in a database management systems.
There are many kinds of data models, some of the most common ones include:

 Hierarchical database model


 Network Model
 Entity-Relationship model
 Relational Model.

 HIERARCHIAL DATABASE MODEL

 It organizes data into a tree like structure with a single root to which all the other
data is linked
 Its structure is a tree with nodes representing records and branches representing
fields
 Data is organized into tree like structure with one to many relationship between
two different types of data(1:n)
Example: One department can have many courses many professors and of course
many students.

 Network database Model


 Extension of the hierarchical model.
 Data is organized more like a graph and are allowed to have more than one
parent node.
 This database model was used to map many to many data relationships.
o ER Database Model
 This model is good to design a database which can then be turned into tables
in relational model.
 Entity- An entity in an ER Model is a real world entity having properties
called attributes.
 Every attribute is defined by its set of values called domain.
 Relationship: The logical association among entities is called relationship.

o RELATIONAL DATABASE MODEL

 Data is organized in two dimensional tables and the relationship is


maintained by storing a common field.
 A relation is a table with rows and columns.
 Three key terms used in relation are relations, attributes and domains.
 Attributes are the named columns in a relation.
 Domain is the set of values the attributes can take.
DATABASE INSTANCE AND SCHEMA
 The collection of information stored in the database at a particular moment is called
instance of the database.
 The overall design of the database is called DATABASE SCHEMA.
Example : The physical schema describes the database design at the physical level.

1) A database may also have several schemas at the view level sometimes called
subschemas that describes different views of the database.

Database state:
Refers to content of a database at a moment in time.
DATABASE THREE-SCHEMA ARCHITECTURE

1) PHYSICAL LEVEL OR INTERNAL LEVEL .


 The lowest level of abstraction describes how the data are actually stored.
 It explains complex low-level data structures in detail.

2) LOGICAL LEVEL OR CONCEPTUAL LEVEL.


 Describes what data are stored in the database and what relationships exist
among those data.
 Describes the entire database in terms of a small number of relatively simple
structures.
 Database Administrators use the logical level of abstraction.
3) VIEW LEVEL OR EXTERNAL LEVEL
 The highest level of abstraction describes only part of the entire database.
 The view level abstraction exists to simplify their interaction with the system.
 The system may provide many views for the same database.
DATABASE INDEPENDENCE
 It helps to change the database schema at one level of a database system without
having to change the schema at the next higher level.
 Two types of Data Independence

1) Physical Data Independence.


2) Logical Data Independence

1) PHYSICAL DATA INDEPENDENCE.


 It is easy to change the physical storage structures or devices
with an effect on the conceptual schema.
 Physical data independence occurs at the logical interface level.
 Eg: Change of location of database from C drive to D drive,
switching to different data structures.
2) LOGICAL DATA INDEPENDENCE
 Characteristics of being able to change the conceptual schema
without having to change the external schema.
 Used to separate the external level from the conceptual view.
 Logical data independence occurs at the user interface.
 If we do any changes in the conceptual view of the data then the
user view of the data would not be affected.
 Eg: Merging two records into one or Breaking an existing record
into two or more records.

DATABASE LANGUAGE

 Database language is used to read, store and update the data in the database.
 The following are the database languages:
 Data definition language (DDL)
 Data Manipulation Language(DML)
 Data Control Language (DCL)
 Transaction Control Language(TCL)
1) Data Definition Language (DDL)
 It is used for specifying the database schema.
 The language is used to create database, alter database, rename database or drop
database.
 It is a type of language that allows the DBA or user to depict and name those
entities, attributes, and relationships that are required for the application along with
any associated integrity and security constraints.
 DDL statements include:
CREATE: create new database, table
ALTER: used to remove all records from a table, including all spaces allocated
for the records are removed.
DROP: Drop the database table.
RENAME: Set a new name for the table.
TRUNCATE: used to remove all records from a table including all spaces
allocated for the records are removed.
2) Data Manipulation Language(DML)
 Data manipulation language is used for both reading and updating the database
 DML statements are used to manage data within schema objects.
 The language used to manipulate the database like inserting data, updating
table, retrieving record from a table.
 DML statements include:
SELECT: It retrieves data from a database.
INSERT: It inserts data into a table.
UPDATE: It updates existing data within a table.
DELETE: It deletes all records from a table, the space for the records remain.
3) Data Control Language (DCL)
 The data control language is used to control privilege in database.
 To perform any operation in the database such as for creating tables, sequences
or views we need privileges.
 DCL statements includes:
GRANT: give privilege to access the database.
REVOKE: Take back the privilege to access the database.
4) Transaction Control Language(TCL)
 Transaction Control statements are used to run the changes made by DML
statements.
 It allows statements to be grouped into logical transactions.
 TRANSACTION CONTROL statements includes:
COMMIT: It saves the work done.
SAVEPOINT: It identifies a point in a transaction to which you can later
roll back
ROLLBACK: It restores the database to original since the last COMMIT.
SET TRANSACTION: It changes the transaction options like isolation level
and what rollback segment to use

Database Interfaces

 The user and the database are connected through DBMS interfaces.
 They give users an easy-to-use interface so they may access and change the data
that is stored in the database.
 There are several DBMS interface types, each created to meet certain user
requirements.
 Command-Line Interface (CLI)
 The earliest and most fundamental form of DBMS interface is the
command-line interface (CLI).
 Through the use of a command prompt, users may communicate with
the database by inputting commands.
 Users can only access and modify the database using particular
commands and syntax.
 Today, programmers and database administrators are the main users
of CLI.
 Graphical User Interface (GUI)
 The most prevalent kind of DBMS interface used nowadays is the
graphical user interface (GUI).
 Users may interact with the database using the user-friendly interface's
graphical menus and icons.
 GUIs are user-friendly and need little to no programming experience.
 They are mostly utilized by non-programmers who are end users.
 Web-Based Interface
 Users can access the database using a browser using the web-based
interface.
 Users can use online forms, buttons, and other graphical components
to interact with the database using a web browser.
 Because they can be accessed from any location with an internet
connection, web-based interfaces are common.
 Natural Language Interface
 This interface enables users to communicate with the database in their
own language.
 The system will convert user inquiries into SQL instructions and carry
them out if they are entered in plain English.
 Users who are unfamiliar with SQL commands might benefit from using
natural language interfaces.
 Forms-Based Interface
Using the forms-based interface, users may enter data into the
database using a graphical user interface.
 Users can complete pre-made forms that provide fields for particular
categories of information, such as name, address, and phone number.
 Applications for data entry frequently employ forms-based interfaces.
 Menu-Based Interface
 Users have access to a number of predefined menus and choices when
using the menu-based interface to interact with the database.
 Users can choose the menu choice that reflects the intended action,
such as adding or removing data, from the available options.
 The majority of specialized applications and embedded systems
employ menu-based interfaces.

Components of DBMS

1. Hardware
o Here the hardware means the physical part of the DBMS. Here the hardware includes
output devices like a printer, monitor, etc., and storage devices like a hard disk.
o In DBMS, information hardware is the most important visible part.
o The equipment which is used for the visibility of the data is the printer, computer,
scanner, etc. This equipment is used to capture the data and present the output to
the user.
o With the help of hardware, the DBMS can access and update the database.

2. Software
o Software is the main component of the DBMS.
o Software is defined as the collection of programs that are used to instruct the
computer about its work.
o The software consists of a set of procedures, programs, and routines associated with
the computer system's operation and performance. Also, we can say that computer
software is a set of instructions that is used to instruct the computer hardware for the
operation of the computers.

3. Data
o The term data means the collection of any raw fact stored in the database.
o Here the data are any type of raw material from which meaningful information is
generated.
o The database can store any form of data, such as structural data, non-structural data,
and logical data.
o The structured data are highly specific in the database and have a structured format.

4. Procedures
o The procedure is a type of general instruction or guidelines for the use of DBMS. This
instruction includes how to set up the database, how to install the database, how to
log in and log out of the database, how to manage the database, how to take a backup
of the database, and how to generate the report of the database.
o In DBMS, with the help of procedure, we can validate the data, control the access and
reduce the traffic between the server and the clients.
o The DBMS can offer better performance to extensive or complex business logic when
the user follows all the procedures correctly.
o The main purpose of the procedure is to guide the user during the management and
operation of the database.
5. Database Access Language

o Database Access Language is a simple language that allows users to write commands
to perform the desired operations on the data that is stored in the database.
o Database Access Language is a language used to write commands to access, insert,
and delete data stored in a database.
o It includes DDL,DML,DCL etc.

Centralized database architecture

 In this database system, application programs and user interface all are
executed on a single system and dummy terminals are connected to it.
 The processing power of single system is utilized and dummy terminals are
used only to display the information.
 In this approach application programs and database system are placed in the
client side.
Client server architecture

 The DBMS design depends upon its architecture.


 The basic client/server architecture is used to deal with a large number of
PCs, web servers, database servers and other components that are
connected with networks.
 The client/server architecture consists of many PCs and a workstation which
are connected via the network.
1-Tier Architecture

o In this architecture, the database is directly available to the user. It


means the user can directly sit on the DBMS and uses it.
o Any changes done here will directly be done on the database itself. It
doesn't provide a handy tool for end users.
o The 1-Tier architecture is used for development of the local application,
where programmers can directly communicate with the database for
the quick response.
2-Tier Architecture
o The 2-Tier architecture is same as basic client-server. In the two-tier
architecture, applications on the client end can directly communicate
with the database at the server side. For this interaction, API's
like: ODBC, JDBC are used.
o The user interfaces and application programs are run on the client-
side.
o The server side is responsible to provide the functionalities like: query
processing and transaction management.
3-Tier Architecture
o The 3-Tier architecture contains another layer between the client and
server. In this architecture, client can't directly communicate with the
server.
o The application on the client-end interacts with an application server
which further communicates with the database system.
o End user has no idea about the existence of the database beyond the
application server. The database also has no idea about any other user
beyond the application.
o The 3-Tier architecture is used in case of large web application
Classification of Database Management Systems
 Several criteria are normally used to classify DBMSs.
 The first is the data model on which the DBMS is based.
o The main data model used in many current commercial DBMSs is
the relational data model.
o The object data model has been implemented in some
commercial systems but has not had widespread use. Many legacy
applications still run on database systems based on
the hierarchical and network data models.
 The second criterion used to classify DBMSs is the number of
users supported by the system.
o Single-user systems support only one user at a time and are
mostly used with PCs. Multiuser systems, which include the
majority .
 The third criterion is the number of sites over which the database is
distributed.
o A DBMS is centralized if the data is stored at a single computer
site.
o A centralized DBMS can support multiple users, but the DBMS
and the database reside totally at a single computer site.
o A distributed DBMS (DDBMS) can have the actual database and
DBMS software distributed over many sites, connected by a
computer network.of DBMSs, support con-current multiple users.
 The fourth criterion is cost. It is difficult to propose a classification of DBMSs
based on cost.
o Today we have open source (free) DBMS products like MySQL and
PostgreSQL that are supported by third-party vendors with
additional services.
o The main RDBMS products are available as free examination 30-
day copy versions as well as personal versions, which may cost
under $100 and allow a fair amount of functionality.
 We can also classify a DBMS on the basis of the types of access path options
for storing files.
o Finally, a DBMS can be general purpose or special purpose.
o When performance is a primary consideration, a special-purpose
DBMS can be designed and built for a specific application; such a
system cannot be used for other applications without major
changes.
o Many airline reservations and telephone directory systems devel-
oped in the past are special-purpose DBMSs.
o These fall into the category of online transaction
processing (OLTP) systems, which must support a large number
of concurrent transactions without imposing excessive delays.

Relational model concept

Domain: The domain refers to the possible values each attribute can contain. It can be
specified using standard data types such as integers, floating numbers, etc.

Attribute: A column or attribute is a vertical entity in the table which contains all
information associated with a specific field in a table.

Tuples: A row of a table is also called a record or tuple. It contains the specific
information of each entry in the table. It is a horizontal entity in the table.

Relation: Everything in a relational database is stored in the form of relations. The


RDBMS database uses tables to store data. A table is a collection of related data
entries and contains rows and columns to store data.
Degree:

The total number of attributes that comprise a relation is known as the degree of the table.

Cardinality:

The total number of tuples at any one time in a relation is known as the table's cardinality.

Keys

Keys are one of the basic requirements of a relational database model. It is widely used
to identify the tuples (rows) uniquely in the table
Primary key:
There can be more than one candidate key in relation out of which one can be
chosen as the primary key.
It is a unique key.
It can identify only one tuple (a record) at a time.
Super key
The set of attributes that can uniquely identify a tuple is known as Super Key.
Candidate key:
The minimal set of attributes that can uniquely identify a tuple is known as a
candidate key.
Properties of a Relation:

o Each relation has a unique name by which it is identified in the database.


o Relation does not contain duplicate tuples.
o The tuples of a relation have no specific order.
o All attributes in a relation are atomic, i.e., each cell of a relation contains exactly one
value.
o A table is the simplest example of data stored in RDBMS.

Types of Relational Models


 It is basically classified into 3 types:
 Conceptual Data Model
 Representational Data Model
 Physical Data Model
Conceptual Data Model
 The conceptual data model describes the database at a very high level and is
useful to understand the needs or requirements of the database.
 It is this model, that is used in the requirement-gathering process .i.e. before
the Database Designers start making a particular database.
 One such popular model is the entity/relationship model (ER model).
Representational Data Model

 This type of data model is used to represent only the logical part of the
database and does not represent the physical structure of the database.
 The representational data model allows us to focus primarily, on the design
part of the database.
 A popular representational model is a Relational model. The relational Model
consists of Relational Algebra and Relational Calculus.

Physical Data Model

 The physical Data Model is used to practically implement Relational Data


Model.
 Ultimately, all data in a database is stored physically on a secondary storage
device such as discs and tapes. This is stored in the form of files, records, and
certain other data structures.
 It has all the information on the format in which the files are present and the
structure of the databases, the presence of external data structures, and
their relation to each other.
 Here, we basically save tables in memory so they can be accessed efficiently.
In order to come up with a good physical model, we have to work on the
relational model in a better way.
 Structured Query Language (SQL) is used to practically implement Relational
Algebra.

Relational Constraints
 Domain Constraints

o Every domain must contain atomic values (smallest indivisible units)


which means composite and multi-valued attributes are not allowed.
o We perform a data type check here, which means when we assign a data
type to a column we limit the values that it can contain.
o Eg. If we assign the data type of attribute age as int, we can’t give it
values other than int data type.
 Key Constraints or Uniqueness Constraints
o These are called uniqueness constraints since it ensures that every tuple
in the relation should be unique.
o A relation can have multiple keys or candidate keys(minimal superkey),
out of which we choose one of the keys as the primary key, we don’t
have any restriction on choosing the primary key out of candidate keys,
but it is suggested to go with the candidate key with less number of
attributes.
o Null values are not allowed in the primary key, hence Not Null
constraint is also part of the key constraint.
 Entity Integrity Constraints
o Entity Integrity constraints say that no primary key can take a NULL
value, since using the primary key we identify each tuple uniquely in
a relation.
 Referential Integrity Constraints

o The Referential integrity constraint is specified between two relations or


tables and used to maintain the consistency among the tuples in two
relations.
o This constraint is enforced through a foreign key, when an attribute in
the foreign key of relation R1 has the same domain(s) as the primary key
of relation R2, then the foreign key of R1 is said to reference or refer to
the primary key of relation R2.
o The values of the foreign key in a tuple of relation R1 can either take the
values of the primary key for some tuple in relation R2, or can take NULL
values, but can’t be empty.

Relation Schema in DBMS


o Relation schema defines the design and structure of the relation like it consists of
the relation name, set of attributes/field names/column names. every attribute
would have an associated domain.
o There is a student named Geeks, she is pursuing B.Tech, in the 4th year, and
belongs to IT department (department no. 1) and has roll number 1601347 She is
proctored by Mrs. S Mohanty. If we want to represent this using databases we
would have to create a student table with name, sex, degree, year, department,
department number, roll number and proctor (adviser) as the attributes.

student (rollNo, name, degree, year, sex, deptNo, advisor)

You might also like