0% found this document useful (0 votes)
36 views100 pages

DBMS_UNIT-1

Uploaded by

Nikitha Nikki
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)
36 views100 pages

DBMS_UNIT-1

Uploaded by

Nikitha Nikki
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/ 100

Please read this disclaimer before

proceeding:
This document is confidential and intended solely for the educational purpose
of RMK Group of Educational Institutions. If you have received this document
through email in error, please notify the system manager. This document
contains proprietary information and is intended only to the respective group /
learning community as intended. If you are not the addressee you should not
disseminate, distribute or copy through e-mail. Please notify the sender
immediately by e-mail if you have received this document by mistake and
delete this document from your system. If you are not the intended recipient
you are notified that disclosing, copying, distributing or taking any action in
reliance on the contents of this information is strictly prohibited.
20CB402

Database
Management
Systems
Department: Computer Science and Business
Systems
Batch/Year: 2021-2025 / II Year

Created by:

Ms. Indhumathi C

Edited by:

Ms. Mary Shiba C

Date:
18.01.2023
Table of Contents

Sl. Topics Page


No. No.
1. Contents 5

2. Course Objectives 6

3. Pre Requisites (Course Name with Code) 7

4. Syllabus (With Subject Code, Name, LTPC details) 8

5. Course Outcomes (6) 9

6. CO-PO/PSO Mapping 10

Lecture Plan (S.No., Topic, No. of Periods, Proposed date, 12


7. Actual Lecture Date, pertaining CO, Taxonomy level, Mode of
Delivery)

8. Activity based learning 13

Lecture Notes ( with Links to Videos, e-book reference, PPTs, 14


9.
Quiz and any other learning materials )
Assignments ( For higher level learning and Evaluation - 85
10.
Examples: Case study, Comprehensive design, etc.,)
11. Part A Q & A (with K level and CO) 88

12. Part B Qs (with K level and CO) 95

Supportive online Certification courses (NPTEL, Swayam, 96


13.
Coursera, Udemy, etc.,)
14. Real time Applications in day to day life and to Industry 97

Contents beyond the Syllabus ( COE related Value added 98


15.
courses)
16. Assessment Schedule ( Proposed Date & Actual Date) 99

17. Prescribed Text Books & Reference Books 100

18. Mini Project 101


Course Objective

Understand the basic concepts of Database, why its required and what its benefits
& advantage

Apply effective relational database design concepts.

Know the fundamental concepts of transaction processing, concurrency control


techniques and recovery procedure.

How to efficiently model and design various database objects and entities

To implement efficient data querying and updates, with needed configuration


Pre Requisites

20CB303 - Object Oriented Programming


20IT201 – Data Structures and Algorithm
Syllabus
20CB402 DATABASE MANAGEMENT SYSTEMS + LAB L T P C
3 0 2 4

UNIT I INTRODUCTION 9

Introduction: Introduction to Database. Hierarchical, Network and Relational Models.


Database system architecture: Data Abstraction, Data Independence, Data Definition
Language (DDL), Data Manipulation Language (DML). Data models: Entity-relationship
model, network model, relational and object oriented data models, integrity constraints,
data manipulation operations.

UNIT II RELATIONAL QUERY LANGUAGE 9

Relational query languages: Relational algebra, Tuple and domain relational calculus,
SQL3, DDL and DML constructs, Open source and Commercial DBMS - MYSQL, ORACLE,
DB2, SQL server. Relational database design: Domain and data dependency,
Armstrong's axioms, Functional Dependencies, Normal forms, Dependency preservation,
Lossless design.

UNIT III QUERY PROCESSING AND STORAGE 9

Query processing and optimization: Evaluation of relational algebra expressions,


Query equivalence, Join strategies, Query optimization algorithms. Storage strategies:
Indices, B-trees, Hashing.

UNIT IV TRANSACTION PROCESSING 9

Transaction processing: Concurrency control, ACID property, Serializability of


scheduling, Locking and timestamp based schedulers, Multi-version and optimistic
Concurrency Control schemes, Database recovery.

UNIT V DATA BASE SECURITY AND ADVANCED DATABASES 9

Database Security: Authentication, Authorization and access control, DAC, MAC and
RBAC models, Intrusion detection, SQL injection. Object oriented and object relational
databases, Logical databases, Web databases, Distributed databases, Data warehousing
and data mining.
Course Outcomes
CO1: Able to design and deploy an efficient & scalable data storage node for
varied kind of application requirements

CO2: Map ER model to Relational model to perform database design effectively

CO3: Write queries using normalization criteria and optimize queries

CO4: Compare and contrast various indexing strategies in different database


systems

CO5: Appraise how advanced databases differ from traditional databases.


CO-PO/PSO Mapping

POs/PSOs

COs

PSO3
PO6

PO7
PO1

PO2

PO3

PO4

PO5

PO8

PO9

PSO

PSO
PO1

PO1

PO1

2
1
0

2
CO1 3 3 3 - 1 - - - 2 - - 3 2 2 2
CO2 3 3 3 3 1 - - - - - - 3 2 2 3
CO3 3 3 3 3 2 - - - - - - 3 2 2 3
CO4 3 3 3 3 3 - - - - - - 3 2 2 3
CO5 3 3 3 3 2 - - - - - - 3 2 2 3
Unit I
Introduction
Lecture Plan
UNIT - I
Actual Date
S. Scheduled Mode of Taxonom
Topic of CO
No. Date Delivery y Level
Completion

Introduction to Chalk and


1 18.1.2023 CO1
Database Talk

Hierarchical, Chalk and


2 Network and 19.1.2023 CO1 Talk
Relational Models
Database system
architecture: Data Chalk and
3 19.1.2023 CO1
Abstraction, Data Talk
Independence
Data Definition Chalk and
4 20.1.2023 CO1
Language (DDL) Talk

Data Manipulation Chalk and


5 23.1.2023 CO1
Language (DML). Talk
Data models: Entity-
Chalk and
6 relationship model, 25.1.2023 CO1 Talk
network model
Relational and Chalk and
7 object oriented data 26.1.2023 CO1 Talk
models
Chalk and
8 Integrity constraints 26.1.2023 CO1
Talk
Data manipulation CO1
9 27.1.2023 Quiz
operations.
ACTIVITY BASED LEARNING

Crossword Puzzle:

Left to Right:

1. A statement which returns user defined error message(9)


2. A function which divides the result set into a specified number of groups(5)
3. A function which returns the number of characters of the specified string expression(3)
4. Combines each row from one table with each row of the other table(9)
5. Synonyms for ROW(5)
Top to Bottom:

2. A SET operation which stop the message number of rows affected(7)


6. A statement that remove all the rows from a table(8)
7. A standard communication protocol to interchange information in a structured format within a
distributed environment(4)

8. The process of compiling and breaking the components of stored procedure into various parts(7)
9. Replaces NULL with the specified replacement value(6)
Right to Left:

10. Combines the results of two or more queries into a single result as a distinct output(5)
11. A statement evaluates a list of conditions and returns one of the various possible results(4)
12. A keyword matches the given character string with the specified pattern(4)
13. A virtual table that provides access to a subset of columns from one or more tables(4)
Bottom to Top:

14. A operator used to transform a set of columns into values(5)


15. An Index that sorts and stores the data rows in the table based on their key values(9)
Lecture notes: Unit I
Introduction

Databases and database technology have had a major impact on the growing use
of computers. It is fair to say that databases play a critical role in almost all areas
where computers are used, including business, electronic commerce, social
media, engineering, medicine, genetics, law, education, and library science.

The term data can be defined as a set of isolated and unrelated raw facts with an
implicit meaning. Data can be anything such as, name of a person, a number,
images, sound, etc. For example, ‗Monica,‗ ‗25,‗ ‗student,‗ etc., is a data. When
the data is processed and converted into a meaningful and useful form, it is
known as information.

Database:

A database can be defined as a collection of related data from which users can
efficiently retrieve the desired information.

A database can be anything from a simple collection of roll numbers, names,


addresses, and phone numbers of students to a complex collection of sound,
images, and even video or film clippings.

A database has the following implicit properties:


 A database represents some aspect of the real world, sometimes called the
miniworld or the universe of discourse (UoD). Changes to the miniworld are
reflected in the database.

 A database is a logically coherent collection of data with some inherent


meaning. A random assortment of data cannot correctly be referred to as a
database.

 A database is designed, built, and populated with data for a specific purpose.
It has an intended group of users and some preconceived applications in
which these users are interested.
Purpose of Database:

In the early days, database applications were built directly on top of file systems.
For example, consider a savings-bank enterprise that keeps information about all
customers and savings accounts in files. The users can manipulate the
information in the files using application programs. Some of the programs are,
A program to debit or credit an account

A program to add a new account

A program to find the balance of an account

A program to generate monthly statements

System programmers wrote these applications to meet the needs of the bank.
New application programs are written as the need arises. For example, if the
savings bank decides to offer checking accounts, the bank creates new
permanent files that contain information about all the checking accounts, and
system programmers has to write new application programs to deal with
situations that do not arise in savings accounts, such as overdrafts. Thus as time
goes by, the system requires more files and more application programs . This
leads to several disadvantages as given below:

Disadvantages in file systems

1) Data redundancy and inconsistency

Since different programmers create the files and application programs, the files
will have a different format and the programs may be written in several
programming languages. Also the same information may be duplicated in several
files. For example the address and telephone number of a particular customer
may appear in a file that consists of saving-account records and in a file that
consist of checking account records. This redundancy leads to higher storage
and access cost.
Data inconsistency occurs, if the various copies of the same data may no longer
agree. For example, a changed customer address may be reflected in savings
account records but not elsewhere in the system.

2) Difficulty in accessing data

Suppose that a bank officer needs to find the names of all customers who live in a
particular postal-code area. The officer insists the data processing department to
generate such a list. The original system has no application program to meet the
request. However, the system has an application program to generate the list of
all customers. The officer has only two choices: either can obtain the list of all
customers and extract the needed information manually or ask the system
programmer to write the necessary application program. Both are unsatisfactory.

Thus the conventional file-processing environments do not allow needed data to


be retrieved in a convenient and efficient manner.

3) Data isolation

Because data are scattered in various files, and files may be in different formats,
writing new application programs to retrieve the appropriate data is difficult.

4) Integrity problems
The data values stored in a database must satisfy some consistency constraints.
For example, the balance of a bank account may never fall below a prescribed
amount (say, $50). Developers enforce these constraints in the system by adding
appropriate code in the various application programs. However, when new
constraints are added it is difficult to change the programs to enforce them.
5) Atomicity Problems

A computer system like any other mechanical or electrical device is subject to


failure. In many applications, if a failure occurs, it is difficult to restore the data to
a consistent state as it existed prior to the failure. For example consider a
program to transfer $50 from account A to account B. if a system failure occurs
during the execution of the program, it is possible that $50 was removed from
account A but was not credited to account B, resulting in inconsistent database
state. The funds transfer must be atomic. It must happen in its entirety or not at
all. Thus it is difficult to ensure atomicity in conventional file processing system.

6) Concurrent access anomalies

To improve the overall performance of the system, many systems allow multiple
users to update the data simultaneously. In such an environment, interaction of
concurrent updates may result in inconsistent data. For example consider bank
account A, containing $500. If two customers withdraw funds (say $50 and $100
respectively) from account at about the same time, the result of the concurrent
executions may leave the account in an incorrect state. If the two programs run
concurrently, they may both read the value $500, and write the result back $450
and $400 respectively. Depending on which one writes the value last, the account
may contain either $450 or $400, rather than the correct value of $350.

7) Security Problems

Every user of the database system should not be able to access all the data. For
example, in a banking system, payroll personnel need to see only that part of the
database that has information about the various bank employees. They do not
need to access information about customer accounts. The file processing systems
do not enforce security constraints
Areas of Database Applications:

Banking: all transactions

Airlines: reservations, schedules

Universities: registration, grades

Sales: customers, products, purchases

Online retailers: order tracking, customized recommendations

Manufacturing: production, inventory, orders, supply chain

Human resources: employee records, salaries, tax deductions Examples of


Database Management Systems

Advantages of Using the Database Approach:

Controlling redundancy in data storage and in development and maintenance


efforts.

Sharing of data among multiple users.

Restricting unauthorized access to data.

Providing persistent storage for program Objects

Object-oriented DBMSs

Providing Storage Structures (e.g. indexes) for efficient Query Processing

Providing backup and recovery services.

Providing multiple interfaces to different classes of users.

Representing complex relationships among data.

Enforcing integrity constraints on the database.


A database management system (DBMS) is a computerized system that
enables users to create and maintain a database.

The DBMS is a general-purpose software system that facilitates the processes of


defining, constructing, manipulating, and sharing databases among various users
and applications.

Defining a database involves specifying the data types, structures, and


constraints of the data to be stored in the database.

The database definition or descriptive information is also stored by the DBMS in


the form of a database catalog or dictionary; it is called meta-data.

Constructing the database is the process of storing the data on some storage
medium that is controlled by the DBMS.

Manipulating a database includes functions such as querying the database to


retrieve specific data, updating the database to reflect changes in the miniworld,
and generating reports from the data.

Sharing a database allows multiple users and programs to access the database
simultaneously.

An application program accesses the database by sending queries or requests for


data to the DBMS.

A query typically causes some data to be retrieved; a transaction may cause some
data to be read and some data to be written into the database.
Other important functions provided by the DBMS include

• Protecting the database and maintaining it over a long period of time.


Protection includes

• System protection against hardware or software malfunction (or


crashes)

• Security protection against unauthorized or malicious access.

Database system: Database and DBMS software together form a database


system.

Figure 1.1: Simple Database System Environment


Characteristics of the Database Approach

• Self-describing nature of a database system

• Insulation between programs and data, and data abstraction

• Support of multiple views of the data

• Sharing of data and multiuser transaction processing

Self-describing nature of a database system

• A fundamental characteristic of the database approach is that the database


system contains not only the database itself but also a complete definition or
description of the database structure and constraints.

• This definition is stored in the DBMS catalog, which contains information such as
the structure of each file, the type and storage format of each data item, and
various constraints on the data.

• The information stored in the catalog is called meta-data, and it describes the

structure of the primary database (Figure 1.1).

• The catalog is used by the DBMS software and also by database users who need
information about the database structure. A general-purpose DBMS software
package is not written for a specific database application. Therefore, it must refer
to the catalog to know the structure of the files in a specific database, such as the
type and format of data it will access.

• In traditional file processing, data definition is typically part of the


application programs themselves. Hence, these programs are
constrained to work with only one specific database, whose structure
is declared in the application programs.
Insulation between Programs and Data, and Data Abstraction

• In traditional file processing, the structure of data files is embedded in the


application programs, so any changes to the structure of a file may require
changing all programs that access that file.

program-data independence

• DBMS access programs do not require such changes in most cases. The
structure of data files is stored in the DBMS catalog separately from the
access programs. We call this property program-data independence

program-operation independence

• An operation (also called a function or method) is specified in two parts.

• The interface (or signature) of an operation includes the operation name and
the data types of its arguments (or parameters).

• The implementation (or method) of the operation is specified separately and


can be changed without affecting the interface.

• User application programs can operate on the data by invoking these

operations through their names and arguments, regardless of how the


operations are implemented. This may be termed program-operation
independence.

Data Abstraction

• The characteristic that allows program-data independence and program-


operation independence is called data abstraction.

• A DBMS provides users with a conceptual representation of data that does

not include many of the details of how the data is stored or how the
operations are implemented.

• Informally, a data model is a type of data abstraction that is used to provide


this conceptual representation.
Figure 1.2. A database that stores information
Support of Multiple Views of the Data

• A database typically has many types of users, each of whom may require a
different perspective or view of the database.

• A view may be a subset of the database or it may contain virtual data that is

derived from the database files but is not explicitly stored.

• Some users may not need to be aware of whether the data they refer to is
stored or derived.

• A multiuser DBMS whose users have a variety of distinct applications must


provide facilities for defining multiple views. For example, one user of the
database of Figure 1.2 may be interested only in accessing and printing the
transcript of each student; the view for this user is shown in Figure 1.4(a). A
second user, who is interested only in checking that students have taken all the
prerequisites of each course for which the student registers, may require the
view shown in Figure 1.4(b).

• Figure 1.4 Two views derived from the database in figure1.2

• (a) Transcript view (b) Course_prerequisties view


Sharing of Data and Multiuser Transaction Processing

• A multiuser DBMS, as its name implies, must allow multiple users to access the
database at the same time.

• This is essential if data for multiple applications is to be integrated and


maintained in a single database.

• The DBMS must include concurrency control software to ensure that several
users trying to update the same data do so in a controlled manner so that the
result of the updates is correct.

• For example, when several reservation agents try to assign a seat on an airline
flight, the DBMS should ensure that each seat can be accessed by only one
agent at a time for assignment to a passenger.

• These types of applications are generally called online transaction processing


(OLTP) applications.

• A fundamental role of multiuser DBMS software is to ensure that concurrent

transactions operate correctly and efficiently.

The different types of people who work in a database system environment are

Actors on the Scene

The people whose jobs involve the day-to-day use of a large database; we
call them the actors on the scene

People who may be called workers behind the scene – those who work
to maintain the database system environment but who are not actively interested in
the database contents as part of their daily job.
.

Database Administrators

• In a database environment, the primary resource is the database itself, and the

secondary resource is the DBMS and related software. Administering these resources is
the responsibility of the database administrator (DBA).

• The DBA is responsible for authorizing access to the database, coordinating and
monitoring its use, and acquiring software and hardware resources as needed.

• The DBA is accountable for problems such as security breaches and poor system
response time.

Database Designers

• Database designers are responsible for identifying the data to be stored in


the database and for choosing appropriate structures to represent and store
this data.

• It is the responsibility of database designers to communicate with all


prospective database users in order to understand their requirements and
to create a design that meets these requirements.

• In many cases, the designers are on the staff of the DBA and may be
assigned other staff responsibilities after the database design is completed.

• Database designers typically interact with each potential group of users and
develop views of the database that meet the data and processing
requirements of these groups.

• Each view is then analyzed and integrated with the views of other user
groups. The final database design must be capable of supporting the
requirements of all user groups.
End users

• Are the people whose jobs require access to the database for querying, updating,

and generating reports; the database primarily exists for their use.

There are several categories of end users:

Casual end users

• Occasionally access the database, but they may need different information each

time.

• They use a sophisticated database query interface to specify their requests and

are typically middle- or high-level managers or other occasional browsers.

Naive or parametric end users

• Their main job function revolves around constantly querying and updating the

database, using standard types of queries and updates— called canned


transactions—that have been carefully programmed and tested.

• Examples: Bank customers and tellers check account balances and post
withdrawals and deposits.

• Reservation agents or customers for airlines, hotels, and car rental companies
check availability for a given request and make reservations.

Sophisticated end users

• Include engineers, scientists, business analysts, and others who thoroughly

familiarize themselves with the facilities of the DBMS in order to implement their
own applications to meet their complex requirements.
Standalone users

• Maintain personal databases by using ready-made program packages that provide


easy-to-use menu-based or graphics-based interfaces.

• An example is the user of a financial software package that stores a variety of


personal financial data.

System Analysts and Application Programmers (Software Engineers)

System analysts determine the requirements of end users, especially naive and
parametric end users, and develop specifications for standard canned transactions
that meet these requirements.

Application programmers implement these specifications as programs; then they


test, debug, document, and maintain these canned transactions.

Such analysts and programmers are commonly referred to as software developers or


software engineers.

Workers behind the Scene

These persons are typically not interested in the database content itself. We call
them the workers behind the scene, and they include the following categories:

DBMS system designers and implementers

Design and implement the DBMS modules and interfaces as a software package.

A DBMS is a very complex software system that consists of many components, or


modules, including modules for implementing the catalog, query language
processing, interface processing, accessing and buffering data, controlling
concurrency, and handling data recovery and security.

The DBMS must interface with other system software, such as the operating system
and compilers for various programming languages.
Tool developers

• Design and implement tools—the software packages that facilitate database


modeling and design, database system design, and improved performance.

• They include packages for database design, performance monitoring, natural


language or graphical interfaces, prototyping, simulation, and test data
generation.

• In many cases, independent software vendors develop and market these tools.

Operators and maintenance personnel (system administration personnel)


are responsible for the actual running and maintenance of the hardware and
software environment for the database system.

Advantages of Using the DBMS Approach

Controlling Redundancy

it is sometimes necessary to use controlled redundancy to improve the performance


of queries.

This redundancy in storing the same data multiple times leads to several
problems.

• First, there is the need to perform a single logical update such as entering data on
a new student multiple times: once for each file where student data is recorded.
This leads to duplication of effort.

• Second, storage space is wasted when the same data is stored repeatedly, and

this problem may be serious for large databases.

• Third, files that represent the same data may become inconsistent.

• Data normalization ensures consistency and saves storage space


Restricting Unauthorized Access

• When multiple users share a large database, it is likely that most users will not be
authorized to access all information in the database. For example, financial data
such as salaries and bonuses is often considered confidential, and only authorized
persons are allowed to access such data.

• In addition, some users may only be permitted to retrieve data, whereas others

are allowed to retrieve and update. Hence, the type of access operation—retrieval
or update—must also be controlled. Typically, users or user groups are given
account numbers protected by passwords, which they can use to gain access to
the database.

• A DBMS should provide a security and authorization subsystem, which the DBA
uses to create accounts and to specify account restrictions.

Providing Persistent Storage for Program Objects

Databases can be used to provide persistent storage for program objects and data
structures.

Programming languages typically have complex data structures, such as structs or


class definitions in C++ or Java.

The values of program variables or objects are discarded once a program


terminates, unless the programmer explicitly stores them in permanent files, which
often involves converting these complex structures into a format suitable for file
storage. When the need arises to read this data once more, the programmer must
convert from the file format to the program variable or object structure. Object-
oriented database systems are compatible with programming languages such as
C++ and Java, and the DBMS software automatically performs any necessary
conversions.
Hence, a complex object in C++ can be stored permanently in an object-oriented
DBMS. Such an object is said to be persistent, since it survives the termination of
program execution and can later be directly retrieved by another program.

Providing Storage Structures and Search Techniques for Efficient Query


Processing

Database systems must provide capabilities for efficiently executing queries and
updates.

The DBMS must provide specialized data structures and search techniques to speed
up disk search for the desired records.

Auxiliary files called indexes are often used for this purpose.

Indexes are typically based on tree data structures or hash data structures that are
suitably modified for disk search.

In order to process the database records needed by a particular query, those


records must be copied from disk to main memory.

Therefore, the DBMS often has a buffering or caching module that maintains
parts of the database in main memory buffers.

The query processing and optimization module of the DBMS is responsible for
choosing an efficient query execution plan for each query based on the existing
storage

Providing Backup and Recovery

A DBMS must provide facilities for recovering from hardware or software failures.
The backup and recovery subsystem of the DBMS is responsible for recovery.
structures.
Providing Multiple User Interfaces

• Because many types of users with varying levels of technical knowledge use a

database, a DBMS should provide a variety of user interfaces.

• These include apps for mobile users, query languages for casual users,
programming language interfaces for application programmers, forms and
command codes for parametric users, and menu-driven interfaces and natural
language interfaces for standalone users. Both forms-style interfaces and menu-
driven interfaces are commonly known as graphical user interfaces (GUIs).

Representing Complex Relationships among Data

• A database may include numerous varieties of data that are interrelated in many
ways

• DBMS must have the capability to represent a variety of complex relationships


among the data, to define new relationships as they arise, and to retrieve and
update related data easily and efficiently.

Enforcing Integrity Constraints

• Most database applications have certain integrity constraints that must hold for
the data.

• A DBMS should provide capabilities for defining and enforcing these constraints.

• The simplest type of integrity constraint involves specifying a data type for each

data item.

• Rules that pertain to a specific data model are called inherent rules of the data
model.

• Constraints may have to be checked by update programs or at the time of data


entry. For typical large applications, it is customary to call such constraints
business rules.
• Another type of constraint specifies uniqueness on data item values, such as
every course record must have a unique value for Course number. This is known
as a key or uniqueness constraint.

• A more complex type of constraint that frequently occurs involves specifying that
a record in one file must be related to records in other files. For example, in
Figure 1.2, we can specify that every section record must be related to a course
record. This is known as a referential integrity constraint.

Permitting Inferencing and Actions Using Rules and Triggers

• Some database systems provide capabilities for defining deduction rules for
inferencing new information from the stored database facts. Such systems are
called deductive database systems

• More powerful functionality is provided by active database systems, which


provide active rules that can automatically initiate actions when certain events
and conditions occur

Potential for Enforcing Standards.

• The database approach permits the DBA to define and enforce standards among
database users in a large organization.

Reduced Application Development Time.

• A prime selling feature of the database approach is that developing a new


application—such as the retrieval of certain data from the database for printing a
new report—takes very little time.
Flexibility

• It may be necessary to change the structure of a database as requirements

change.

• For example, a new user group may emerge that needs information not currently
in the database. In response, it may be necessary to add a file to the database or
to extend the data elements in an existing file

Availability of Up-to-Date Information.

• A DBMS makes the database available to all users. As soon as one user‘s update

is applied to the database, all other users can immediately see this update.

• This availability of up-to-date information is essential for many transaction-


processing applications, such as reservation systems or banking databases, and it
is made possible by the concurrency control and recovery subsystems of a DBMS.

Economies of Scale.

The DBMS approach permits consolidation of data and applications, thus reducing
the amount of wasteful overlap between activities of data-processing personnel in
different projects or departments as well as redundancies among applications.

Applications of DBMS

The following are some examples of the applications:

Scientific applications that store large amounts of data resulting from scientific
experiments in areas such as high-energy physics, the mapping of the human
genome, and the discovery of protein structures ■

Storage and retrieval of images, including scanned news or personal


photographs, satellite photographic images, and images from medical procedures
such as x-rays and MRI (magnetic resonance imaging) tests
Storage and retrieval of videos, such as movies, and video clips from news or
personal digital cameras

Data mining applications that analyze large amounts of data to search for the
occurrences of specific patterns or relationships, and for identifying unusual patterns
in areas such as credit card fraud detection

Spatial applications that store and analyze spatial locations of data, such as
weather information, maps used in geographical information systems, and
automobile navigational systems

Time series applications that store information such as economic data at regular
points in time, such as daily sales and monthly gross national product figures.

Database System Concepts and Architecture

Data Models, Schemas, and Instances

Data Abstraction:A major purpose of a database system is to provide users


with an abstract view of the data. That is, the system hides certain details of how
the data are stored and maintained

Main characteristics of the database approach is to support data abstraction so


that different users can perceive data at their preferred level of detail

A Data Model

A collection of concepts that can be used to describe the structure of a database

Provide the necessary means to achieve this abstraction. By structure of a DB we


mean data types, relationship, and constraints that apply to the data. Most data
model also include a set of basic operation for specifying retrieval and updated on
the database
Introduction to Data Models Types
According to the types of concepts used to describe the database structure, data
models are categorized as follows:
1. Conceptual (high-level, semantic) data models:
 ER Data Model
 Object Based data model
2. Physical (low-level, internal) data models:
• Self Describing data model
3. Implementation (representational) data models:
• Relational data model
• Network data model
• Hierarchical data model

Types of Data Models


Relational Model

The principles of the relational model were first outlined by Dr. E.F. Codd. The
Relational Data model represents a database as a collection of tables, where each
table can be stored as a separate file.

Most relational databases have high-level query languages and support a limited
form of user views. RDBMS relational database management system is based on
the relational model developed by E.F. Codd.

A relational database allows the definition of data structures, storage and


retrieval operations and integrity constraints. In such a database, the data and
relations between them are organized in tables. A table is a collection of records
and each record in a table contains the same fields.
The entity is Employee. The attributes are Emp_code, Name, Designation,
Qualification, Department and Salary. ‗Vidya‘ is a data item for the attribute Name.
‗PG‘ is a data item for the field Qualification.

Properties of Relational Tables


Values are atomic

Each row is unique

Column values are of the same kind


The sequence of columns is insignificant

The sequence of rows is insignificant

Each column has a unique name

The relational database model is based on the Relational Algebra, Relational


calculus.
Network Model
The Network Data Model represents data in terms of records and also 1:N
relationship, called as a Set type. Below Figure shows a network schema diagram,
for the database, where rectangular boxes represent record types and arrows
show set types. This model is associated with record-at a-time language that must
be embedded in a host programming language.

The network model permitted the modeling of many-to-many relationships in


data. The data model is a simple network, and link and intersection record types
(called junction records by IDMS) may exist, as well as sets between them.
Usually, a set defines a 1:M relationship, although 1:1 is permitted.
A network database consists of two data sets

A set records

A set links

The record types are made up of fields in the usual way. Links may be followed in
their direction.

Characteristics of Network Model


1. Data is organized into logical units called record types
2. Record types can have more than one owner (each data grouping can
belong to more than one category)

3. There are many efficient entry points into the database

Hierarchical Model

In a hierarchical data model, data is organized into a tree-like structure. Each


hierarchy represents a number of related records. There is a hierarchy of parent
and child data segments.

This structure implies that a record can have repeating information, generally in
the child data segments. Data in a series of records, which have a set of field
values attached to it.

It collects all the instances of a specific record together as a record type. These
record types are the equivalent of tables in the relational model, and with the
individual records being the equivalent of rows.

To create links between these record types, the hierarchical model uses Parent
Child Relationships. These are a 1:N mapping between record types.
For example, an organization might store information about an employee, such as
name, employee number, department, salary. The organization might also store
information about an employee‘s children, such as name and data of birth.

The employee and children data forms a hierarchy, where the employee data
represents the parent segment and the children data represents the child
segment.

If an employee has three children, then there would be three child segments
associated with one employee segment.

In a hierarchical database the parent-child relationship is one to many. This


restricts a child segment to having only one parent segment.

The first database systems developed were hierarchical. Hierarchical DBMSs were
popular from the late 1960s, with the introduction of IBM‘s Information
Management System (IMS) DBMS, through the 1970s.

The language used for hierarchical model is usually a record-at-a-time language.

Characteristics of Hierarchical Data model

1. Data is grouped into logical units called segment types.

2. Segment types are linked in a parent/child hierarchical where each child segment
type has

only one parent segment type.

3. There is only one efficient entry point.

4. Database use physical pointers to link records.


Advantages

1. The structure of a hierarchical database is easy to understand. The hierarchy is


based on logical relationships between parent and child segment types.

2. They provide very efficient high speed retrieval.

Disadvantages

1. There are difficult to modify as an organization‘s data needs change.

2. It is difficult to use them to represent non-hierarchical relationships

Below figure represents a hierarchical database at a typical school where each


department employs many faculties and each faculty advises many students.
Object Oriented Database:

An object-oriented database (OODBMS) or object database management system


(ODBMS) is a database that is based on object-oriented programming (OOP). The
data is represented and stored in the form of objects. OODBMS are also called
object databases or object-oriented database management systems.

A database is a data storage. A software system that is used to manage


databases is called a database management system (DBMS). There are many
types of database management systems such as hierarchical, network, relational,
object-oriented, graph, and document.

Object-Oriented Database

Object database management systems (ODBMSs) are based on objects in object-


oriented programing (OOP). In OOP, an entity is represented as an object and
objects are stored in memory. Objects have members such as fields, properties,
and methods. Objects also have a life cycle that includes the creation of an
object, use of an object, and deletion of an object. OOP has key characteristics,
encapsulation, inheritance, and polymorphism.

Object databases are commonly used in applications that require high


performance, calculations, and faster results. Some of the common applications
that use object databases are real-time systems, architectural & engineering for
3D modeling, telecommunications, and scientific products, molecular science, and
astronomy.

Advantages of Object Databases

ODBMS provide persistent storage to objects. Imagine creating objects in your


program and saving them as it is in a database and reading back from the
database.
In a typical relational database, the program data is stored in rows and columns.
To store and read that data and convert it into program objects in memory
requires reading data, loading data into objects, and storing it in memory.
Imagine creating a class in your program and saving it as it is in a database,
reading back and start using it again.

Object databases bring permanent persistent to objects. Objects can be stored in


persistent storage forever.

In typical RDBMS, there is a layer of object-relational mapping that maps


database schemas with objects in code. Reading and mapping an object database
data to the objects is direct without any API or OR tool. Hence faster data access
and better performance.

Some object database can be used in multiple languages. For example, Gemstone
database supports C++, Smalltalk and Java programming languages.

Drawbacks of Object Databases

Object databases are not as popular as RDBMS. It is difficult to find object DB


developers.

Not many programming language support object databases.

RDBMS have SQL as a standard query language. Object databases do not have a
standard.

Object databases are difficult to learn for non-programmers.

Popular Object Databases


Object Based Data Model: Extends the E-R model with notions of

 Encapsulation,

 Methods Or

 Functions And

 Object Identity

• Allow attributes of tuples to have complex types, including non-atomic values


such as nested relations.

Entity Relationship Data Model

• Models an enterprise as a collection of entities and relationships.

• Entity: is a ―thing‖ or ―object‖ in the enterprise that is distinguishable from


other objects. They are described by a set of attributes

• Relationship: is an association among several entities

• In the below example, customer and account represents entities,

• the ellipses represent attributes and

• depositor represents relationship among the entities.


COMPONENTS OF DBMS / ARCHITECTURE OF DBMS

A database system is partitioned into modules that deal with each of the
responsibilities of the overall system.

The functional components of a database system can be broadly divided into the
storage manager and the query processor components

Database System Users

There are four different types of database-system users

Naive users: unsophisticated users who interact with the system by invoking one
of the application programs that have been written previously.

Application programmers: are computer professionals who write application


programs.

Sophisticated users: interact with the system without writing programs using a
database query language or by using tools such as data analysis software.

Specialized users: write specialized database applications that do not fit into the
traditional data-processing framework. For example, CAD, graphic data, audio,
video.

Database Administrator: A person who has central control over the system is
called a database administrator DBA, whose functions are:

Schema definition

Storage structure and access-method definition

Schema and physical-organization modification

Granting of authorization for data access


Routine maintenance

Periodically backing up the database

Ensuring that enough free disk space is available for normal operations, and
upgrading disk space as required

Monitoring jobs running on the database and ensuring that performance is not
degraded by very expensive tasks submitted by some users
Query Processor

The query processor is important because it helps the database system to simplify
and facilitate access to data.

The query processor components include:

DDL interpreter: interprets DDL statements and records the definitions in the
data dictionary.

DML compiler: translates DML statements in a query language into an


evaluation plan consisting of low-level instructions that the query evaluation
engine understands. The DML compiler performs query optimization; that is, it
picks the lowest cost evaluation plan from among the various alternatives.

Query evaluation engine: executes low-level instructions generated by the


DML compiler.

Storage Manager

The storage manager is the component of a database system that provides the
interface between the low-level data stored in the database and the application
programs and queries submitted to the system.

A program module that provides the interface between the low-level data stored
in the database and the application programs and queries submitted to the
system.

The storage manager is responsible to the following tasks:

• Interaction with the OS file manager

• Efficient storing, retrieving and updating of data

The storage manager components include:

Authorization and integrity manager


Transaction manager

File manager

Buffer manager

Authorization and integrity manager, which tests for the satisfaction of


integrity constraints and checks the authority of users to access data.

Transaction manager, which ensures that the database remains in a consistent


(correct) state despite system failures, and that concurrent transaction executions
proceed without conflicting.

A transaction is a collection of operations that performs a single logical function in a


database application

File manager, which manages the allocation of space on disk storage and the
data structures used to represent information stored on disk.

Buffer manager, which is responsible for fetching data from disk storage into
main memory, and deciding what data to cache in main memory.

The buffer manager is a critical part of the database system, since it enables the
database to handle data sizes that are much larger than the size of main memory.

The storage manager implements several data structures as part of the


physical system implementation:

Data files: store the database itself

Data dictionary: stores metadata about the structure of the database, in


particular the schema of the database.

Indices: can provide fast access to data items. A database index provides
pointers to those data items that hold a particular value.
Database Languages

A database system provides a data-definition language to specify the database


schema and a data-manipulation language to express database queries and
updates. In practice, the data definition and data-manipulation languages are not
two separate languages; instead they simply form parts of a single database
language, such as the widely used SQL language

Data-Manipulation Language

A data-manipulation language (DML) is a language that enables users to


access or manipulate data as organized by the appropriate data model. The types
of access are:

• Retrieval of information stored in the database

• Insertion of new information into the database

• Deletion of information from the database

• Modification of information stored in the database

There are basically two types:

Procedural DMLs require a user to specify what data are needed and how to
get those data.

Declarative DMLs (also referred to as nonprocedural DMLs) require a user to


specify what data are needed without specifying how to get those data.

Declarative DMLs are usually easier to learn and use than are procedural DMLs.
However, since a user does not have to specify how to get the data, the database
system has to figure out an efficient means of accessing data.

A query is a statement requesting the retrieval of information. The portion of a


DML that involves information retrieval is called a query language.
Although technically incorrect, it is common practice to use the terms query
language and data-manipulation language synonymously.

Data-Definition Language (DDL)

We specify a database schema by a set of definitions expressed by a special


language called a data-definition language (DDL). The DDL is also used to
specify additional properties of the data.

We specify the storage structure and access methods used by the database
system by a set of statements in a special type of DDL called a data storage
and definition language. These statements define the implementation details of
the database schemas, which are usually hidden from the users.

The data values stored in the database must satisfy certain consistency
constraints.

For example, suppose the university requires that the account balance of a
department must never be negative.

The DDL provides facilities to specify such constraints. The database system
checks these constraints every time the database is updated. In general, a
constraint can be an arbitrary predicate pertaining to the database.

However, arbitrary predicates may be costly to test. Thus, database systems


implement integrity constraints that can be tested with minimal overhead.

Domain Constraints. A domain of possible values must be associated with


every attribute (for example, integer types, character types, date/time types).
Declaring an attribute to be of a particular domain acts as a constraint on the
values that it can take. Domain constraints are the most elementary form of
integrity constraint. They are tested easily by the system whenever a new data
item is entered into the database.
Referential Integrity. There are cases where we wish to ensure that a value
that appears in one relation for a given set of attributes also appears in a certain
set of attributes in another relation (referential integrity). For example, the
department listed for each course must be one that actually exists. More precisely,
the dept name value in a course record must appear in the dept name attribute of
some record of the department relation.

Database modifications can cause violations of referential integrity. When a


referential-integrity constraint is violated, the normal procedure is to reject the
action that caused the violation.

Assertions. An assertion is any condition that the database must always satisfy.
Domain constraints and referential-integrity constraints are special forms of
assertions. However, there are many constraints that we cannot express by using
only these special forms. For example, ―Every department must have at least five
courses offered every semester‖ must be expressed as an assertion.

When an assertion is created, the system tests it for validity. If the assertion is
valid, then any future modification to the database is allowed only if it does not
cause that assertion to be violated.

Authorization. We may want to differentiate among the users as far as the type
of access they are permitted on various data values in the database. These
differentiations are expressed in terms of authorization, the most common
being: read authorization, which allows reading, but not modification, of data;
insert authorization, which allows insertion of new data, but not modification of
existing data; update authorization, which allows modification, but not
deletion, of data; and delete authorization, which allows deletion of data. We
may assign the user all, none, or a combination of these types of authorization.
The DDL, just like any other programming language, gets as input some
instructions (statements) and generates some output. The output of the DDL is
placed in the data dictionary, which contains metadata—that is, data about
data. The data dictionary is considered to be a special type of table that can only
be accessed and updated by the database system itself (not a regular user). The
database system consults the data dictionary before reading or modifying actual
data.

INTRODUCTION TO ER MODEL
• Entity-Relationship (ER) model is a diagrammatic representation of logical
structure of database.
• The ER model describes data as entities, relationships, and attributes.
Entity
• An entity is an object that exists and is distinguishable from other objects.
• An entity may be an object with a physical existence or conceptual existence
Example:
Physical existence: a particular person, car, house, or employee
Conceptual existence: a company, a job, or a university course
Entity type:

• An entity type defines a collection (or set) of entities that have the same
attributes.
Entity set:

• The collection of all entities of a particular entity type in the database is called an
entity set.
Attributes:
• Each entity has attributes—the particular properties that describe it.
• Example, an EMPLOYEE entity may be described by the employee‘s name, age,
address, salary, and job.
• A particular entity will have a value for each of its attributes.
Value Sets (Domains) of Attributes:

• Specifies the set of values that may be assigned to that attribute for each
individual entity.

• Value set for the Name attribute to be the set of strings of alphabetic characters
separated by blank characters.

• Value sets are not displayed in ER diagrams.

Types of attributes

1. Simple versus composite,

2. Single valued versus multivalued, and

3. Stored versus derived.

Simple Attribute:

• Attributes that are not divisible are called simple or atomic attributes.

Composite attribute:

• Composite attributes can be divided into smaller subparts.

• Composite attributes can form a hierarchy

• The value of a composite attribute is the concatenation of the values of its


component simple attributes.

Example for Composite Attribute


Single-Valued Attributes:

• Attributes having a single value for a particular entity are called single-valued
attributes

• Example, Age is a single-valued attribute of a person.

Multivalued Attributes:

• Attributes that have a set of values for the same entity are called as multivalued
attributes

• Example: College degrees attribute for a person

• A multivalued attribute may have lower and upper bounds to constrain the
number of values allowed for each individual entity.

Stored versus Derived Attributes:

• In some cases, two (or more) attribute values are related

• Example, the Age and Birthdate attributes of a person.

• The Age attribute is hence called a derived attribute and is said to be derivable
from the Birthdate attribute, which is called a stored attribute.

Null values:

• An attribute takes null value when an entity does not have a value for it.

• Example: Apartment number & Middle name


Relationship Sets in ER Diagram

• Relationship is an association among several entities

• Example:
44553 (Peltier) advisor 22222 (Einstein)
student entity relationship set instructor entity

• John is a student with Einstein as advisor

• A relationship set is a set of relationships of the same type.

• Example: Entity sets: instructor and Student

• Relationship set : advisor

Participation:

• The association between entity sets is referred to as participation.

• Role : The function that an entity plays in a relationship is called as role. Roles
are implicit, and or not specified. If same entity set participates more than once
in a relationship type in different roles, role name becomes essential.

• Recursive relationships: When there is a relationship between two entities of


the same type, it is known as a recursive relationship.
Descriptive attributes:

• Attributes of relationship is called as descriptive attributes.

• Example: the advisor relationship set between entity sets instructor and student
may have the attribute date which tracks when the student started being
associated with the advisor.

Example for Descriptive Attribute

Degree of a Relationship set:

• The degree of a relationship set is the number of participating entity sets.

• A relationship set of degree two is called binary, and one of degree three is called
ternary

• Most relationship sets in a database system are binary.

• Example: students work on research projects under the guidance of an instructor.

• relationship proj_guide is a ternary relationship between instructor, student, and


project
Constraints in ER Model

Constraints:

1. Mapping cardinalities
2. Key constraints
3. Participation constraints

Mapping cardinalities:

• Express the number of entities to which another entity can be associated via a
relationship set.

• Most useful in describing binary relationship sets.

• For a binary relationship set the mapping cardinality must be one of the following types:

1. One to one

2. One to many
3. Many to one

4. Many to many

 One-to-one: An entity in A is associated with at most one entity in B, and an entity in B


is associated with at most one entity in A.

 One-to-many: An entity in A is associated with any number (zero or more) of entities in


B. An entity in B, however, can be associated with at most one entity in A.

(a)One to One & (b)One To Many


 Many-to-one: An entity in A is associated with at most one entity in B. An entity
in B, however, can be associated with any number (zero or more) of entities in A.

 Many-to-many: An entity in A is associated with any number (zero or more) of


entities in B, and an entity in B is associated with any number (zero or more) of
entities in A.

(a)Many to One & (b)Many To Many

Participation Constraints:

• The participation of an entity set E in a relationship set R is said to be total if


every entity in E must participate in at least one relationship in R.

• If it is possible that some entities in E do not participate in relationships in R, the


participation of entity set E in relationship R is said to be partial.

Weak entity set:

• An entity set that does not have a primary key is referred to as a weak entity set.

• The existence of a weak entity set depends on the existence of a identifying


entity set

• It must relate to the identifying entity set via a total, one-to-many relationship set
from the identifying to the weak entity set

• Identifying relationship depicted using a double diamond


Summary of Symbols Used in E-R Notation
Extended ER Features

Specialization:

• Top-down design process; we designate subgroupings within an entity set that

are distinctive from other entities in the set.

• These subgroupings become lower-level entity sets that have attributes or

participate in relationships that do not apply to the higher-level entity set.

• Depicted by a triangle component labeled ISA (E.g. customer ―is a‖ person).

• Attribute inheritance – a lower-level entity set inherits all the attributes and

relationship participation of the higher-level entity set to which it is linked.

Example for Specialization


Generalization:

• A bottom-up design process – combine a number of entity sets that share the

same features into a higher-level entity set.

• Specialization and generalization are simple inversions of each other; they are

represented in an E-R diagram in the same way.

• The terms specialization and generalization are used interchangeably.

• Can have multiple specializations of an entity set based on different features.

Aggregation:

• Treat relationship as an abstract entity

• Allows relationships between relationships

• Abstraction of relationship into new entity

Video Reference – Entity Relation Model

https://www.youtube.com/watch?v=wOD02sezmX8
ER Diagram for University Database
Reducing ER to Relational Model

ER-to-Relational Mapping Algorithm

 Step 1: Mapping of Regular Entity Types

 Step 2: Mapping of Weak Entity Types

 Step 3: Mapping of Binary 1:1 Relation Types

 Step 4: Mapping of Binary 1:N Relationship Types.

 Step 5: Mapping of Binary M:N Relationship Types.

 Step 6: Mapping of Multivalued attributes.

 Step 7: Mapping of N-ary Relationship Types.

Mapping EER Model Constructs to Relations

 Step 8: Options for Mapping Specialization or Generalization.

 Step 9: Mapping of Union Types (Categories).

Step 1: Mapping of Regular Entity Types.

• For each regular (strong) entity type E in the ER schema, create a relation R that includes
all the simple attributes of E.

• Choose one of the key attributes of E as the primary key for R.

• If the chosen key of E is composite, the set of simple attributes that form it will together
form the primary key of R.

Step 2: Mapping of Weak Entity Types

• For each weak entity type W in the ER schema with owner entity type E, create a relation
R & include all simple attributes (or simple components of composite attributes) of W as
attributes of R.

• Also, include as foreign key attributes of R the primary key attribute(s) of the relation(s)
that correspond to the owner entity type(s).

• The primary key of R is the combination of the primary key(s) of the owner(s) and the
partial key of the weak entity type W, if any.
Step 3: Mapping of Binary 1:1 Relation Types

• For each binary 1:1 relationship type R in the ER schema, identify the relations S and T
that correspond to the entity types participating in R.

• There are three possible approaches:

1. Foreign Key approach: Choose one of the relations-say S-and include a foreign key in
S the primary key of T. It is better to choose an entity type with total participation in R
in the role of S.

2. Merged relation option: An alternate mapping of a 1:1 relationship type is possible by


merging the two entity types and the relationship into a single relation. This may be
appropriate when both participations are total.

3. Cross-reference or relationship relation option: The third alternative is to set up a third


relation R for the purpose of cross-referencing the primary keys of the two relations S
and T representing the entity types.

Step 4: Mapping of Binary 1:N Relationship Types.

• For each regular binary 1:N relationship type R, identify the relation S that represent the
participating entity type at the N-side of the relationship type.

• Include as foreign key in S the primary key of the relation T that represents the other
entity type participating in R.

• Include any simple attributes of the 1:N relation type as attributes of S.

Step 5: Mapping of Binary M:N Relationship Types.

• For each regular binary M:N relationship type R, create a new relation S to represent R.

• Include as foreign key attributes in S the primary keys of the relations that represent the
participating entity types; their combination will form the primary key of S.

• Also include any simple attributes of the M:N relationship type (or simple components of
composite attributes) as attributes of S.
Step 6: Mapping of Multivalued attributes.
• For each multivalued attribute A, create a new relation R.
• This relation R will include an attribute corresponding to A, plus the primary key
attribute K-as a foreign key in R-of the relation that represents the entity type of
relationship type that has A as an attribute.
• The primary key of R is the combination of A and K. If the multivalued attribute is
composite, we include its simple components.
Step 7: Mapping of N-ary Relationship Types.
• For each n-ary relationship type R, where n>2, create a new relationship S to
represent R.
• Include as foreign key attributes in S the primary keys of the relations that
represent the participating entity types.
• Also include any simple attributes of the n-ary relationship type (or simple
components of composite attributes) as attributes of S.
Step8: Options for Mapping Specialization or Generalization.
• Convert each specialization with m subclasses {S1, S2,….,Sm} and generalized
superclass C, where the attributes of C are {k,a1,…an} and k is the (primary) key,
into relational schemas using one of the four following options:
 Option 8A: Multiple relations-Superclass and subclasses
 Option 8B: Multiple relations-Subclass relations only
 Option 8C: Single relation with one type attribute
 Option 8D: Single relation with multiple type attributes
Step 9: Mapping of Union Types (Categories).
• For mapping a category whose defining superclass have different keys, it is
customary to specify a new key attribute, called a surrogate key, when creating a
relation to correspond to the category.
Derived Relational Schema for ER Diagram on
University
SQL Fundamentals:

The SQL language has several parts:

Data-definition Language (DDL): the SQL DDL provides commands for defining
relation schemas, deleting relations, and modifying relation schemas.

Interactive data-manipulation language (DML): the SQL DML includes a query


language based on both the relational algebra and the tuple relational calculus. It
includes also commands to insert tuples into, delete tuples from, and modify
tuples in the database.

Data types in SQL:

The SQL standard supports a variety of built-in domain types such as,

char(n). Fixed length character string, with user-specified length n.

varchar(n). Variable length character strings, with user-specified maximum length


n.

int. Integer (a finite subset of the integers that is machine-dependent).

smallint. Small integer (a machine-dependent subset of the integer domain type).

numeric(p,d). Fixed point number, with user-specified precision of p digits, with n


digits to the right of decimal point.

real, double precision. Floating point and double-precision floating point


numbers, with machine-dependent precision.

float(n). Floating point number, with user-specified precision of at least n digits.

date: A calendar date containing a (four digit) year, month and day of the month.

time: the time of day in hours, minutes and seconds.

timestamp: a combination of date and time.

.
Data definition Language:

The SQL data definition language allows specification of not only a set of relations
but also information about each relation, including

• The schema for each relation.

• The domain of values associated with each attribute

• Integrity constraints

• The set of indices to be maintained for each relation.

• Security and authorization information for each relation.

• The physical storage structure of each relation on disk.

DDL Commands:

Create Table Construct:

An SQL relation is defined using the create table command:

Syntax:

create table r (A1 D1, A2 D2, ..., An Dn, (integrity-constraint1), ...,


(integrity-constraintk))

where,
r is the name of the relation
each Ai is an attribute name in the schema of relation r
Di is the data type of values in the domain of attribute Ai

The allowed integrity constraints include

Primary key : The primary key specification says that attributes are required to be
non-null and unique. That is no tuple can have a null value for a primary key
attribute, and also there should not be duplicate values.

Check (P) : the check clause specifies a predicate P that must be satisfied by every
tuple in the relation.
Unique : it will not allow duplicate values and null values. The difference between
the primary key and the unique key is that there can be more than unique key

attribute.

Not null: it will not allow null values.

Example:

create table student(name char(15) not null, student_id char(10),


degree_level char(15), primary key(student_id), check(degree_level in
(‗bachelors‘, ‘masters‘, ‘doctorate‘)));

Referential Integrity:

Referential integrity is a relational database concept in which multiple


tables share a relationship based on the data stored in the tables, and that
relationship must remain consistent. This integrity is enforced using foreign key
constraint.

There are actually 3 rules that referential integrity enforces:

We may not add record to the child table unless the foreign key for that record
points to an existing record in the parent table.

If a record in the parent table is deleted all corresponding records in the child table
must be deleted using a cascading delete.

If the primary key for a record in the parent table changes, all corresponding
records in the child table must be modified using cascading update.

Syntax:

Create table table_name(col1 datatype,col2 datatype,…,coln datatype, foreign


key(col1,col2,…,coln) references parent_table(col1,col2,…,coln));
Example:

Parent table:

Create table supplier(supid int,sname varchar(20),addr varchar(20),primary


key(supid));

Child table:

Create table products(pid int,supid int,foreign key(supid) references


supplier(supid));

Alter table:

Alter table command is used to add, modify or drop attributes or columns from
the table.

Syntax:

alter table <table-name> add/modify <col-name1><datat ype>,….,<col-


namen><data type>;

alter table <table-name> drop <col-name>;

Example:

alter table emp add year char(3);

Truncate table:

The truncate table command deletes the rows in the table but retains the table
structure.

Syntax:

truncate table <table-name>;

Example:

Truncate table emp;


Drop table:

Deletes the table from the database.

Syntax:

drop table <table-name>

Example:

drop table emp;

Data Manipulation Language:

It includes also commands to insert tuples into, delete tuples from, and modify
tuples in the database.

DML Commands:

Basic Query Structure:

The basic structure of an SQL expression consists of three clauses: select, from,
and where.

The select clause corresponds to the projection operation of the relational


algebra. It is used to list the attributes desired in the result of a query.

The from clause corresponds to the Cartesian-product operation of the relational


algebra. It lists the relations to be scanned in the evaluation of the expression.

The where clause corresponds to the selection predicate of the relational


algebra. It consists of a predicate involving attributes of the relations that appear
in the from clause.
A typical SQL query has the form:
select A1, A2, ..., An
fromr1, r2, ..., rm
where P

Each Ai represents an attribute

Ri represents a relation and P is a predicate.

This query is equivalent to the relational algebra expression.

1) The Select Clause:

The select clause list the attributes desired in the result of a query. It corresponds
to the projection operation of the relational algebra

Example: find the names of all branches in the loan relation:

Sql query: select branch_name from loan

Relational algebra expression: branch_name (loan)

The result is a relation consisting of a single attribute with the heading


branch-name.

Elimination of Duplicates:

To eliminate duplicates, the keyword distinct is inserted after select as below.

Sql query:

select distinct branch_name from loan

Without Duplication:

SQL uses the keyword all to specify explicitly that duplicates are not removed.
Sql query:

select all branch_name from loan

Selection of all attributes:

The * symbol can be used to denote all attributes.

Sql query:

select * from loan

Arithmetic operators:

The select clause may also contain arithmetic expressions involving the operators
+,-,*, and / operating on constants or attributes of tuples.

Sql Query:

Select loan-number, branch-name, amount * 100 from loan

will return a relation that is same as the loan relation, except that the attribute
amount is multiplied by 100.

The Where Clause:

Example: Find all loan numbers for loans made at the perryridge branch with loan
numbers greater then $1200.

Sql query:

Select loan-number from loan where branch-name = ‗perryridge and amount


>1200

SQL uses the logical connectives and, or, and not rather than mathematical
symbols in the where clause.
Between Operator:

Sql includes a between comparison operator to simplify where clauses that


specify that a value be less than or equal to some value and greater than or equal
to some other value.

Example: Find the loan number of those loans with loan amounts between $90,000
and $100,000.

Sql Query:

select loan-number from loan where amount between 90000 and 100000

2) Deletion:

A delete request is expressed in much the same way as a query. Sql expresses a
deletion by

delete from r where P

where P represents a predicate and r represents a relation. The delete statement


first finds all the tuples in r for which P(t) is true, and then deletes them from
r. the where clause can be omitted, in which case all tuples in r are deleted.

delete command operates on only one relation. To delete values from several
relations delete command should be used for each relation separately.

Examples: delete from loan;

deletes all the tuples from the relation.

delete from account where branch-name = ‗Perryridge‘;

deletes all account tuples in the Perryridge branch.

delete from loan where amount between 1300 and 1500;


deletes all the loan amounts between 1300 and 1500.

Delete from account where branch-name in(select branch-name from branch


where branch-city = ‗Needham‘);

The delete request can contain a nested select that references the relation from
which tuples are to be deleted. For example, to delete the records of all accounts
with balances below the average at the bank, the following query is used.

delete from account where balance< ( select avg (balance) from account);

The above query first tests each tuple in the relation account to check whether
the account has a balance less than the average at the bank. Then, all tuples that
fail the test are deleted.

3) Insertion:

To insert data into a relation, the attribute values of inserted tuples must be the
members of the attribute‘s domain. Similarly, tuples inserted must be of the
correct type.

Example1:

insert into account values(‗a-101‘,‘perryridge‘,1200);

inserts the specified values into the relation account.

Example 2:

insert into account values(‗&aacount-no‘,‘&branch-name‘,&amt);

inserts more than one value with one insert statement.

Example 3:

Insert into account select loan-number,branch-name from loan where branch-


name = ‗perryridge‘;

Inserts tuples into account relation which is taken from loan relation.
Example 4:

Insert into depositor select customer-name, loan-no from borrower, loan where
borrower.loan-no = loan.loan-no and branch-name = ‗Perryridge‘;

Selects the tuples from borrower and loan relations whose loan numbers are
equal, also whose branch is perryridge and inserts those tuples into the relation
depositor.

Example 5:

insert into account select * from account;

4)Updates:

Update statement is used to change the values of the tuples without affecting
other tuples in the relation.

Example 1:

update account set balance = balance * 1.05;

updates the balance as specified in the condition.

Example 2:

update account set balance = balance * 1.05 where balance >=1000;

updates the balance as specified in the condition where balance is greater than or
equal to1000.

Example 3:

Sql provides a case construct, which performs two updates with a single update
statement.

update account set balance = case when balance <= 10000 then balance *
1.05 else balance * 1.06 end;
Integrity Constraints

Integrity constraints are a set of rules. It is used to maintain the quality of


information.

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.

Thus, integrity constraint is used to guard against accidental damage to the


database.

Types of Integrity Constraint

1. Domain constraints

Domain constraints can be defined as the definition of a valid set of values for an
attribute.

The data type of domain includes string, character, integer, time, date, currency,
etc. The value of the attribute must be available in the corresponding domain.

Example:
2..Entity integrity constraints

The entity integrity constraint states that 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.

A table can contain a null value other than the primary key field.

Example:

3.Referential Integrity Constraints

A referential integrity constraint is specified between two tables.

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.
Example:

4. Key constraints

Keys are the entity set that is used to identify an entity within its entity set
uniquely.

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

Example:
ASSIGNMENTS
1. Consider the employee database.

Emp(ename,street,city)

Works(ename,companyname,salary)

Company(companyname,city)

Manages(ename,managername)

Give the expression in SQL to express each of the following queries:

1. Find the names of all employees who work for First Bank Corporation.

2. Find the names, street address, and cities of residence of all employees
who work for first Bank Corporation and earn more than 200000 per annum.

4. Find the names of all employees in this database who live in the same city
as the companies for which they work.

5. Find the names of all employees who live in the same city and on the same
street as do their managers.

6. Find the names of all employees who earn more than every employees of
small bank corporation.
ASSIGNMENTS
2. Consider the following schema:

Suppliers(sid: integer, sname: string, address: string)

Parts(pid: integer, pname: string, color: string)

Catalog(sid: integer, pid: integer, cost: real)

The key fields are underlined, and the domain of each field is listed after the field
name. Therefore sid is the key for Suppliers, pid is the key for Parts and sid and pid
together form the key for Catalog. The Catalog relation lists the prices charged for
parts by Suppliers. Write the following queries in relational algebra and SQL.

Find the sids of suppliers who supply some red or green part.

Find the sids of suppliers who supply every part.

Find the sids of suppliers who supply every red part or supply every green part.

Find sailors who‘ve reserved at least one boat

3. Consider the following relation:

Emp(ename,street,city)

Works(ename,companyname,salary)

Company(companyname,city)

Manages(ename,managername)

Give the SQL DDL definition of this database. Identify referential integrity constraints
that should hold and include them in the DDL definition.
ASSIGNMENTS
4. Express in SQL Queries:

Consider relations:

Country (name, continent, population, GDP, life-expectancy)

River(name, origin,length)

City (name, country, population)

GDP and population in million.

Find all countries whose GDP is greater than $500 billion but less than $1 trillion.

List the life expectancy in countries that have river originating in them.

Find all cities that are either in South America or whose population is less than 2
million.

List all cities which are not in South America.

5. Consider the database given in the following schema:

Customer(Cust_No, Sales_Person_No, City)

Sales_Person(Sales_Person_No, Sales_Person_Name, Common_Prec, Year_of_Hire)

Give an expression in SQL for each of the following queries.

Display the list of all customers by Cust_No with the city in which each is located.

List the names of the sales persons who have accounts in Delhi.
11. Part A Question & Answer
Unit - 1 RELATIONAL DATABASES

S.No Question and Answers CO K


1 What is database? CO1 K1
A database is a collection of inter related data.

2 Define Database Management System. CO1 K1


A Database management System consists of a collection
interrelated data and set of programs to access those data.

3 What are the advantages of DBMS? CO1 K1


• Redundancy is controlled
• Unauthorized access is restricted.
• Providing multiple user interface
• Enforcing integrity constraints.
• Providing backup

4 List any eight applications of DBMS. CO1 K1


a) Banking
b) Airlines
c) Universities
d) Credit card transactions
e) Tele communication
f) Finance g) Sales
h) Manufacturing
i) Human resources

5 Define Data Models CO1 K1


A collection of conceptual tools for describing data, data
relationships, data semantics and
consistency constraints.

6 Define Relational model. CO1 K1


The relational model uses a collection of tables to represent
both data and the relationships
among those data. Each table has multiple columns, and
each columns has a unique name.

7 How do data represent in network model? CO1 K1


Data in the networks model are represented by collection of
records and relationships among data are represented by
links, which can be viewed as pointers. The records in the
database are organized as collections of arbitrary graphs.
S.No Question and Answers CO K
8 Write about the role of Transaction manager. CO1 K1
Transaction manager is responsible for ensuring that the
database remains in a consistent state despite system
failures.
The TM also ensures that concurrent transaction executions
proceed without conflicting.

9 Define Hierarchical Model CO1 K1


The hierarchical model is similar to the network models in
the sense that data and relationship among data are
represented by records and links respectively. It differ from
the network model in that the records are organized as
collection of trees rather that arbitrary Graphs.
10 List the role of DBA. CO1 K1
The person who has central control over the system is called
database administrator. The
function of the DBA include the following:
Schema definition
Storage structure and access-method definition
Schema and physical-organization modification
Granting of authorization for data access
Integrity-constraint specification

11 List the different type of database system user. CO1 K1


There are four different types of database-system users,
differentiated by the way they expect
to interact with the system.
Application programmers
Sophisticated Users
Specialized users
Naïve user
12 What are the components of storage manager? CO1 K1
The storage manager components include
a) Authorization and integrity manager
b) Transaction manager
c) File manager
d) Buffer manager
S.No Question and Answers CO K
13 Define instance and schema? CO1 K1
Instance: Collection of data stored in the data base at a
particular moment is called an Instance of the database.
Schema: The overall design of the data base is called the
data base schema.

14 Write about role of storage manager. CO1 K1


A SM is a program module that provides the interface
between the low-level data stored in
the database and the application programs and queries
submitted to the system. The SM is
responsible for interaction with the data stored on disk.
15 List the levels of Data Abstraction. CO1 K1
Physical level, Logical Level, View Level.

16 Define Data Abstraction CO1 K1


A major purpose of a database system is to provide users
with an abstract view of the data.
That is, the system hides certain details of how the data are
stored and maintained.
17 Define Data Independence. CO1 K1
The ability to modify a schema definition in one level without
affecting a schema definition
in the next higher level is called data independence. There
are two levels of data
independence: Physical data independence, and Logical data
independence.
18 What is the Difference between Physical and Logical CO1 K1
Data Independence?
Physical Data Independence – is the ability to modify the
physical or internal schema without changing the logical or
external schemas.
Logical Data Independence – is the ability to modify logical
or conceptual schema without changing the external
schemas or application programs.
19 Define the terms 1) Physical schema 2) logical CO1 K1
schema.
Physical schema: Describes the database design at the
physical level, which is the lowest level of abstraction
describing how the data are actually stored.
Logical schema: describes the database design at the logical
level, which describes what data are stored in the database
and what relationship exists among the data.
S.No Question and Answers CO K
20 Define entity and entity set. CO1 K1
An entity is a ―thing‖ or ―object‖ in the real world that is
distinguishable from other objects. For example, each person
is an entity, and bank accounts can be considered to be
entities. The set of all entities of the same type are termed
an entity set.
21 Define E-R model. CO1 K1
The entity-relationship data modal is based on perception of
a real world that consists of a collection of basic objects,
called entities, and of relationships among these objects.
The overall logical structure of a database can be expressed
graphically by an E-R diagram, which is built up from the
following components: Rectangles, which represent entity
sets. Ellipses, which represent attributes Diamonds, which
represent relationships among entity sets Lines, which link
attributes to entity sets and entity sets to relationships.
22 Define the terms i) Domain ii) Relational schema CO1 K1
A domain D is a set of atomic values. Atomic means that
each value in the domain is indivisible as far as the relational
model is concerned.
A relational schema R, denoted by R (A1, A2,….An) made up
of a relation name R and a list of attributes A1, A2,…An)
23 Define DML. CO1 K1
By data manipulation, we mean The retrieval of information
stored in the database. The insertion of new information into
the database
The deletion of information from the database
The modification of information stored in the database.
A DML is a language that enables users to access or
manipulate data as organized by the appropriate data model.
There are two types: Procedural DMLs and
Nonprocedural DMLs.
24 Define DDL. CO1 K1
A database schema is specified by a set of definitions
expressed by a special language called a data-definition
language. The result of compilation of DDL statements is a
set of tables that is stored in a special file called data
dictionary. A data dictionary is a file that contains metadata-
that is, data about data. The storage structure and access
methods used by the database system are specified by a set
of definitions in a special type of DDL called a data
storage and definition language
S.No Question and Answers CO K
25 Why should we use constraints in Relational data CO1 K1
model? List the types of integrity constraints.
Relational data model includes several types of constraints
whose purpose is to maintain accuracy and integrity of the
data in the database. The major types of integrity constraints
are:
i) Domain constraints ii) Entity integrity constraints iii)
Referential integrity constraints iv) Check Contraints

26 Define attributes. CO1 K1


Entities are described in a database by a set of attributes. For
example, the attributes accountnumber
and balance describe one particular account in a bank.

27 What is a super key? CO1 K1


A super key is a set of one or more attributes that collectively
allows us to identify uniquely
an entity in the entity set.
28 List the table modification commands in SQL? CO1 K1
Deletion
Insertion
Updates
Update of a view
29 Define Nested Sub queries. CO1 K1
SQL provides a mechanism for the nesting of sub queries. A
sub query is a select-from-where expression that is nested
within another query. A common use of sub queries is to
perform tests for set membership, set comparisons, and set
cardinality.
30 Define Embedded SQL. CO1 K1
The SQL standard defines embeddings of SQL in a variety of
programming languages, such as Pascal, PL/I, Fortran, C, and
COBOL. A language in which SQL queries are embedded is
referred to as a host language, and the SQL structures
permitted in the host language constitute embedded SQL.
31 Define Referential Integrity. CO1 K1
Often, we wish to ensure that a value that appears in one
relation for a given set of attributes also appears for a certain
set of attributes in another relation. This condition is called
referential integrity.
S.No Question and Answers CO K
32 Define Nested Sub queries. CO1 K1
SQL provides a mechanism for the nesting of sub queries. A
sub query is a select-from-where expression that is nested
within another query. A common use of sub queries is to
perform tests for set membership, set comparisons, and set
cardinality.

33 What is a data dictionary? CO1 K1


A data dictionary is a data structure which stores meta data
about the structure of the database ie. the schema of the
database
34 Define Null Values. CO1 K1
SQL allows the use of null values to indicate absence of
information about the value of an attribute.

35 Define tuple and attribute CO1 K1


• Attributes: column headers
• Tuple : Row
36 Define the term Key? CO1 K1
A key allows the users to identify a set of attributes that
suffice to distinguish entities from each other. Key uniquely
identifies relationships and distinguishes the relationships
from each other.
37 Define the term Domain. CO1 K1
For each attribute there is a set of permitted values called the
domain of that attribute.
38 List the data structures implemented by the storage CO1 K1
manager The storage manager implements the following
data structure
a) Data files b) Data dictionary c) Indices
39 What is a foreign key? CO1 K1
A foreign key is an attribute or attribute combination of one
relation (table) whose values are required to match those of
the primary key of some other relation (table).
40 Define Embedded SQL. CO1 K1
The SQL standard defines embeddings of SQL in a variety of
programming languages, such as Pascal, PL/I, Fortran, C, and
COBOL. A language in which SQL queries are embedded is
referred to as a host language, and the SQL structures
permitted in the host language constitute embedded SQL.
S.No Question and Answers CO K
41 Define Query and Query language. CO1 K1
A query is a statement requesting the retrieval of information.
The portion of a DML that
involves information retrieval is called query language.

42 Define Aggregate Functions. CO1 K1


Aggregate functions are functions that take a collection of
values as input and return a
single value. SQL offers five built-in aggregate functions:
Average: avg ,Minimum: min, Maximum: max, Total: sum,
Count: count
43 List the possible operations is Relational Algebra. CO1 K1
Select operation
Project operation
Union operation
Set Difference operation
Cartesian Product operation
Rename operation
Set-Intersection operation
Natural-join operation
Division
Assignment operation
44 Define Super key. CO1 K1
A super key is a set of one or more attributes that, taken
collectively, allow us to identify uniquely an entity in the
entity set. For example, the social-security attribute of the
entity set customer is sufficient to distinguish one customer
entity from another. Similarly, the combination of customer-
name and social security is a super key for the entity set
customer.
45 Define Primary key. CO1 K1
Superkeys for which no proper subset is a super key. Such
minimal superkeys are called candidate keys or primary keys.
For example, the social-security attribute of the entity set
customer is sufficient to distinguish one customer entity from
another.
46 Define Assertions. CO1 K1
An assertion is a predicate expressing a condition that we
wish the database always satisfied.
E.g.) create assertion check
PART - B
1. Discuss the various disadvantages of file system and explain how it can be overcome
by the database system.(CO1 )(K2)

2. Explain the difference between logical and physical data independence. (CO1 )(K1)
3. Compare the features of conventional database system system with database system.
(CO1 )(K2)

4. With a neat diagram, explain the structure of a DBMS. (CO1 )(K2)

5. Explain the purpose of database system. (CO1 )(K1)

6. Explain the three different groups of data models with examples. (CO1 )(K2)

7. Explain components of DBMS with neat diagram. (CO1 )(K2)

8. Explain in detail about Entity Relational Model with suitable examples. (CO1 )(K2)

9. Consider the employee database where the primary keys are underlined. (CO1 )(K4)

a. Emp(ename,street,city)

b. Works(ename,companyname,salary)

c. Company(companyname,city)

d. Manages(ename,managername)

Find the names of all employees who work for First Bank Corporation.
Find the names, street address, and cities of residence of all employees who work for first
Bank Corporation and earn more than 200000 per annum.

Find the names of all employees in this database who live in the same city as the
companies for which they work.

Find the names of all employees who earn more than every employees of small bank
corporation.

10. Explain DDL commands with examples. (CO1 )(K2)

11. Explain DML commands with examples. (CO1 )(K2)

12. Explain Integrity Constraints in detail with example(CO1 )(K2)

13. What are the major components used in ER diagram. Explain in detail(CO1 )(K2)

14.Give detailed notes on Entity relation modeling(CO1 )(K2)


SUPPORTIVE ONLINE CERTIFICATION COURSES

Sl.N Name of the Name of the Course Website Link


o. Institute
1. Coursera Introduction to https://www.coursera.org/lear
Structured Query n/intro-sql
Language (SQL)

2. Coursera Querying Databases https://www.coursera.org/pro


Using SQL SELECT jects/querying-databases-
statement using-sql-select-statement

3. Coursera Relational database https://www.coursera.org/lear


systems n/relational-database

4. Udemy The Complete SQL https://www.udemy.com/cour


Bootcamp 2021: Go from se/the-complete-sql-
Zero to Hero bootcamp/

5. Udemy The Complete Oracle SQL https://www.udemy.com/cour


Certification Course se/the-complete-oracle-sql-
certification-course/
6. Udemy Microsoft SQL for https://www.udemy.com/cour
Beginners se/microsoft-sql-for-
beginners/
7. Udemy SQL for Data Analysis: https://www.udemy.com/cour
Weekender Crash Course se/sql-for-newbs/
for Beginners

8. Udemy Master SQL For Data https://www.udemy.com/cour


Science se/master-sql-for-data-
science/
REAL TIME APPLICATIONS IN DAY TO DAY LIFE AND
TO INDUSTRY

Application and Uses of Database Management System (DBMS)

Railway Reservation System.


Library Management System
Banking System
Universities and colleges Management Systems
Credit card transactions.
Social Media Sites
Telecommunications
Finance Applications
CONTENT BEYOND SYLLABUS

What Is MongoDB?
MongoDB is a document database with the scalability and flexibility that you want
with the querying and indexing that you need
Makes development easy
MongoDB‘s document model is simple for developers to learn and use, while still
providing all the capabilities needed to meet the most complex requirements at
any scale. We provide drivers for 10+ languages, and the community has built
dozens more.
MongoDB stores data in flexible, JSON-like documents, meaning fields can vary from
document to document and data structure can be changed over time
The document model maps to the objects in your application code, making data
easy to work with
Ad hoc queries, indexing, and real time aggregation provide powerful ways to access
and analyze your data
MongoDB is a distributed database at its core, so high availability, horizontal scaling,
and geographic distribution are built in and easy to use
MongoDB is free to use.
MongoDB Architecture
MongoDB is designed to meet the demands of modern apps with a technology
foundation that enables you through:
The document data model – presenting you the best way to work with data.
A distributed systems design – allowing you to intelligently put data where you
want it.
A unified experience that gives you the freedom to run anywhere – allowing you
to future-proof your work and eliminate vendor lock-in.
Assessment Schedule
Assessment I
Proposed Date : 28.2.2023
Actual Date :
Text Books & References
TEXT BOOKS:
1. Abraham Silberschatz, Henry F.Korth, S. System 6 th Edition, Tata McGraw Hill,2011.
2. Elmasri R. and S. Navathe, Database Systems: Models, Languages, Design and
Application Programming, Pearson Education, 2013.

REFERENCES:
1. Principles of Database and Knowledge – Base Systems, Vol 1 by J. D. Ullman.
2. Foundations of Databases. Serge Abiteboul, Richard Hull, Victor Vianu.
18. MINI PROJECT SUGGESTIONS

Design a Relational database for the following


1) Insurance Management System
The insurance management project deals the adding new insurance schemes and managing the
clients for the insurance. The project has complete access for the crud operations that are to
create, read, update and delete the database entries. At first you need to add a branch and the
staff members for the branch then secondly add a user to the database now you can add an
insurance scheme and finally make the payments for the client to the added insurance.

2. Hospital Data Management

Hospitals have unique data requirements. They have to maintain the medical records of their
patients, and manage their staff and its multiple departments. You can solve the data-related
problems of hospitals by creating a DBMS solution.

First, you should assign unique IDs to the patients and store the relevant information under
the same. You‘ll have to add the patient‘s name, personal details, contact number, disease
name, and the treatment the patient is going through. You‘ll also have to mention under
which hospital department the patient is (such as cardiac, gastro, etc.).

A doctor can treat multiple patients, and he/she would have a unique ID as well. Doctors
would also be classified in different departments.

Patients would get admitted into rooms, so you‘ll need to add that information in your
database too. Then, you‘d have to add the information of ward boys and nurses working in
the hospital and assigned to different rooms.

3. Blood Donation Management

You should start by adding donor names and assign them unique IDs. Add their details and
relevant information such as blood type, medical report, and contact number. Similarly, add
patient names with unique IDs, details on their medical conditions, and blood types.

After you‘ve created a database of patients and donors, you can work on a database for the
blood bank. There, you‘ll have to add the name of the blood bank, its staff details, operating
hours, and address.
18. MINI PROJECT SUGGESTIONS

4) Inventory Management
The project starts by adding a seller and by adding details of customer. the user can now
purchase new products by the desired seller and then can sell them to the customer, the
purchasing and selling of products is reflected in the inventory section. The main aim of
Inventory Management Mini DBMS project is to add new products and sell them and keep an
inventory to manage them.

5) Pharmacy management System


The project starts by adding a dealer and by adding details of customer. the user can now
purchase new medicines by the desired dealer and then can sell them to the customer added
the purchasing and selling of medicines is reflected in the inventory section.

6) Library management system


there will be an admin who will be responsible for manages the system. The admin will look
after how many books are available in the library and he can update them if any new books
brought to the library. Perform operations like adding a book to the database, view all books
which are added, search for a specific book, issue books, and retrieve the book from users.

7) Hotel management system

Add features like providing the menu of the food items that are prepared in the hotel. Provide
the menu and prices of the food in the hotel. you can add the online food ordering facility to
this which will give a good impression on the project. we can also book the tables in the
project. Add a feature that will show the collection of the day this will be only viewed by the
admin. we can also provide online booking of rooms also. Improve this with some other
features.
Thank you

Disclaimer:

This document is confidential and intended solely for the educational purpose of RMK Group
of Educational Institutions. If you have received this document through email in error,
please notify the system manager. This document contains proprietary information and is
intended only to the respective group / learning community as intended. If you are not the
addressee you should not disseminate, distribute or copy through e-mail. Please notify the
sender immediately by e-mail if you have received this document by mistake and delete this
document from your system. If you are not the intended recipient you are notified that
disclosing, copying, distributing or taking any action in reliance on the contents of this
information is strictly prohibited.

You might also like