Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
46 views

Database Unit1 Notes For Reference

The document discusses database management systems and related concepts. It begins by describing the three schema architecture of DBMS - the physical, logical, and external levels. It then discusses data abstraction, data independence, and some advantages of DBMS over file structures like reduced data redundancy and improved data sharing and security. SQL is introduced as the standard language for communicating with relational databases, along with its uses for data definition, manipulation, and control.

Uploaded by

Saban Choudhury
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Database Unit1 Notes For Reference

The document discusses database management systems and related concepts. It begins by describing the three schema architecture of DBMS - the physical, logical, and external levels. It then discusses data abstraction, data independence, and some advantages of DBMS over file structures like reduced data redundancy and improved data sharing and security. SQL is introduced as the standard language for communicating with relational databases, along with its uses for data definition, manipulation, and control.

Uploaded by

Saban Choudhury
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Paper-MCA203

Database Management Systems


UNIT-I: 10hrs
Introduction to DBMS: Characteristics, Purpose, Application of the Database approach,
Advantages of using DBMS approach upon file structure, Three-schema Architecture, Data
Abstraction, Data Independence, Data base languages, DBMS Architecture, Data Models
overview, Introduction to ER model and Relational data model.
Relational Query Language: Relational algebra, Tuple and Domain Relational Calculus, SQL.

What is Database?

The database is a collection of inter-related data which is used to retrieve, insert and delete the
data efficiently. It is also used to organize the data in the form of a table, schema, views, and
reports, etc.

What is DBMS? Explain.

Database management system is software that is used to manage the database.

o For example: MySQL, Oracle, etc are a very popular commercial database
which is used in different applications.
o DBMS provides an interface to perform various operations like database
creation, storing data in it, updating data, creating a table in the database
and a lot more.
o It provides protection and security to the database. In the case of multiple
users, it also maintains data consistency.

DBMS allows users the following tasks:

o Data Definition: It is used for creation, modification, and removal of


definition that defines the organization of data in the database.
o Data Updation: It is used for the insertion, modification, and deletion of
the actual data in the database.
o Data Retrieval: It is used to retrieve the data from the database which can
be used by applications for various purposes.
o User Administration: It is used for registering and monitoring users,
maintain data integrity, enforcing data security, dealing with concurrency
control, monitoring performance and recovering information corrupted by
unexpected failure.

Characteristics of DBMS / Purpose of Database


o It uses a digital repository established on a server to store and manage the
information.
o It can provide a clear and logical view of the process that manipulates
data.
o DBMS contains automatic backup and recovery procedures.
o It contains ACID properties which maintain data in a healthy state in case
of failure.
o It can reduce the complex relationship between data.
o It is used to support manipulation and processing of data.
o It is used to provide security of data.
o It can view the database from different viewpoints according to the
requirements of the user.

What are Advantages of using DBMS approach upon file structure?

Advantages of DBMS over File system:

 Data redundancy and inconsistency: Redundancy is the concept


of repetition of data i.e. each data may have more than a single copy.
The file system cannot control the redundancy of data as each user
defines and maintains the needed files for a specific application to run.
 Data sharing: The file system does not allow sharing of data or
sharing is too complex. Whereas in DBMS, data can be shared
easily due to a centralized system.
 Data concurrency: Concurrent access to data means more than
one user is accessing the same data at the same time.
 Data searching: For every search operation performed on the file
system, a different application program has to be written. While
DBMS provides inbuilt searching operations. The user only has to
write a small query to retrieve data from the database.
 Data integrity: There may be cases when some constraints need
to be applied to the data before inserting it into the database. The
file system does not provide any procedure to check these
constraints automatically. Whereas DBMS maintains data integrity
by enforcing user-defined constraints on data by itself.
 System crashing: In some cases, systems might have crashed
due to various reasons.
 A DBMS will have the recovery manager which retrieves the data
making it another advantage over file systems.
 Data security: A file system provides a password mechanism to
protect the database but how long can the password be protected?
No one can guarantee that. This doesn’t happen in the case of
DBMS. DBMS has specialized features that help provide shielding
to its data.
 Backup: It creates a backup subsystem to restore the data if
required.
 Interfaces: It provides different multiple user interfaces like
graphical user interface and application program interface.
 Easy Maintenance: It is easily maintainable due to its centralized
nature.
=================-------------------------=======================-------------===========

What is Data Abstraction and Explain Three-Schema Architecture.

Data Abstraction is a process of hiding unwanted or irrelevant details from the end
user. It provides a different view and helps in achieving data independence which is
used to enhance the security of data.

The three schema architecture describes how the data is represented or


viewed by the user in the database.

There are mainly 3 levels of data abstraction:


 Physical or internal level: This is the lowest level of data abstraction. ...
 Logical or conceptual: This level comprises the information that is actually
stored in the database in the form of tables. ...
 External or View level: This is the highest level of abstraction.
The three schema architecture divides the database into three-level to create a separation
between the physical database and the user application. In simple words, this architecture hides
the details of physical storage from the user. The database administrator (DBA) should be able
to change the structure of database storage without affecting the user’s view.
This architecture contains three layers or levels of the database management system:
1. External or View level: This is the highest level of database abstraction. External or view level
describes the actual view of data that is relevant to the particular user. For Example, FACULTY of
a university is interested in looking course details of students, STUDENTS are interested in
looking at all details related to academics, accounts, courses and hostel details as well. So,
different views can be generated for different users. The main focus of external level is data
abstraction.

2. Conceptual or Logical level: The conceptual level describes the structure of the whole
database. This level acts as a middle layer between the physical storage and user view. It
explains what data to be stored in the database, what relationship exists among those data, and
what the datatypes are. There is only one conceptual schema per database.

At conceptual level, data is represented in the form of various database tables. For Example,
STUDENT database may contain STUDENT and COURSE tables which will be visible to users but
users are unaware of their storage.Also referred as logical schema,it describes what kind of data
is to be stored in the database.

3. Internal or Physical level: This is the lowest level of database abstraction. It describes how
the data is actually stored in the database and provides methods to access data from the
database. It allows viewing the physical representation of the database on the computer
system.

1.

=============================----------------------------===============

What is Data Independence?


Data independence means a change of data at one level should not affect another level. Two
types of data independence are present in this architecture:

Physical Data Independence: Any change in the physical location of tables and indexes should
not affect the conceptual level or external view of data.

Conceptual Data Independence: The data at conceptual level schema and external level schema
must be independent. This means a change in conceptual schema should not affect external
schema. e.g.; Adding or deleting attributes of a table should not affect the user’s view of the
table.

Explain Data base languages. / Explain SQL (Structured Query Language).

A DBMS provides necessary database languages that allow users to express database updates
and queries, which are requests for data.

SQL is used to communicate with a database.

SQL is the standard language for dealing with Relational Databases. SQL can be used to insert,
search, update, and delete database records.

Here are four types of database languages and their uses:

1. Data definition language (DDL)

Data definition language (DDL) creates the framework of the database by


specifying the database schema, which is the structure that represents the
organization of data.

 CREATE: Creates a new database or object, such as a table,


index or column
 ALTER: Changes the structure of the database or object
 DROP: Deletes the database or existing objects
 RENAME: Renames the database or existing objects

2. Data manipulation language (DML)

Data manipulation language (DML) provides operations that handle user


requests, offering a way to access and manipulate the data that users store
within a database. Its common functions include inserting, updating and
retrieving data from the database. Here's a list of DML statements:

 INSERT: Adds new data to the existing database table


 UPDATE: Changes or updates values in the table
 DELETE: Removes records or rows from the table
 SELECT: Retrieves data from the table or multiple tables

3. Data control language (DCL)

Data control language (DCL) controls access to the data that users store within a
database. Essentially, this language controls the rights and permissions of the
database system. It allows users to grant or revoke privileges to the database.
Here's a list of DCL statements:

 GRANT: Gives a user access to the database


 REVOKE: Removes a user's access to the database

4. Transaction control language (TCL)

Transaction control language (TCL) manages the transactions within a database.


Transactions group a set of related tasks into a single, executable task. All the
tasks must succeed in order for the transaction to work. Here's a list of TCL
statements:

 COMMIT: Carries out a transaction


 ROLLBACK: Restores a transaction if any tasks fail to execute
 SAVEPOINT: Sets a point in a transaction to save

====================---------------------------==========================

Explain DBMS Architecture.

DBMS Architecture
o 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.
o The client/server architecture consists of many PCs and a workstation which are
connected via the network.
o DBMS architecture depends upon how users are connected to the database to
get their request done.

Types of DBMS Architecture


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.
o To communicate with the DBMS, client-side application establishes a connection
with the server side.
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.
============================-------------------------------===========

Explain Data Models.

Data Models
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. Therefore,
there are following four data models used for understanding the structure of the
database:
1) Relational Data Model: This type of model designs the data in the form of rows and columns
within a table. Thus, a relational model uses tables for representing data and in-between
relationships. Tables are also called relations. This model was initially described by Edgar F.
Codd, in 1969. The relational data model is the widely used model which is primarily used by
commercial data processing applications.

2) Entity-Relationship Data Model: An ER model is the logical representation of data as objects


and relationships among them. These objects are known as entities, and relationship is an
association among these entities. This model was designed by Peter Chen and published in 1976
papers. It was widely used in database designing.

3) Object-based Data Model: An extension of the ER model with notions of functions,


encapsulation, and object identity, as well. This model supports a rich type system that includes
structured and collection types.

4) Semistructured Data Model: The semistructured data model allows the data specifications at
places where the individual data items of the same type may have different attributes sets. The
Extensible Markup Language, also known as XML, is widely used for representing the
semistructured data.

=============================-=------------------------------------------==========

What is ER model?

ER model
o ER model stands for an Entity-Relationship model. It is a high-level data model.
This model is used to define the data elements and relationship for a specified
system.
o It develops a conceptual design for the database. It also develops a very simple
and easy to design view of data.
o In ER modeling, the database structure is portrayed as a diagram called an entity-
relationship diagram.

For example, Suppose we design a school database. In this database, the student will be an
entity with attributes like address, name, id, age, etc. The address can be another entity with
attributes like city, street name, pin code, etc and there will be a relationship between them.
1. Entity:
An entity may be any object, class, person or place. In the ER diagram, an entity
can be represented as rectangles.

Consider an organization as an example- manager, product, employee,


department etc. can be taken as an entity.

An entity that depends on another entity called a weak entity. The weak entity doesn't contain
any key attribute of its own. The weak entity is represented by a double rectangle.
2. Attribute
The attribute is used to describe the property of an entity. Eclipse is used to represent an
attribute.

For example, id, age, contact number, name, etc. can be attributes of a student.

a. Key Attribute

The key attribute is used to represent the main characteristics of an entity. It


represents a primary key. The key attribute is represented by an ellipse with the
text underlined.

b. Composite Attribute

An attribute that composed of many other attributes is known as a composite


attribute. The composite attribute is represented by an ellipse, and those ellipses
are connected with an ellipse.
c. Multivalued Attribute

An attribute can have more than one value.

d. Derived Attribute

An attribute that can be derived from other attribute is known as a derived


attribute. It can be represented by a dashed ellipse.

For example, A person's age changes over time and can be derived from another attribute like
Date of birth.

3. Relationship
A relationship is used to describe the relation between entities. Diamond
or rhombus is used to represent the relationship.
========================------------------------------------===============================

Explain Relational data model?


The relational model in DBMS is an abstract model used to organize and manage the data stored
in a database.

================================--------------------------------===========================

Explain Relational Query Language: Relational algebra.

RELATIONAL ALGEBRA is a widely used procedural query language.

Relational algebra is a procedural query language that works on relational model. The purpose
of a query language is to retrieve data from database or perform various operations such as
insert, update, delete on the data.

SELECT (σ) Operation-

The SELECT operation is used for selecting a subset of the tuples according to a given selection
condition. Sigma(σ)Symbol denotes it. It is used as an expression to choose tuples which meet
the selection condition. Select operator selects tuples that satisfy a given predicate.

Example--

Project Operation (∏)

It projects column(s) that satisfy a given predicate.

Example---

Join Operation –
==============-------------------------=================================

Explain Tuple and Domain Relational Calculus.

Relational calculus is a non-procedural query language that tells the system what data to be
retrieved but doesn’t tell how to retrieve it.
==================================----------------------------====================

You might also like