Department of Information Technology
Semester III- K Scheme
Unit 1 : Introduction to Database
               System
             (12 Marks)
              Presented By :
           Mrs. Samidha Chavan
Lecturer -Department of Information Tech.
Vidyalankar Polytechnic, Wadala (Mumbai)
1.1 Database Concepts
Data
       Data is known facts that can
       be recorded and stored on
       computer media.
Data and Information
           Data is known facts that
            can be recorded and stored
            on computer media.
           Information is meaningful
            data.
Data and Information
           Data is known facts that
            can be recorded and stored
            on computer media.
           Information is meaningful
            data.
Data
Data is the raw material that can be processed
for any computing machine.
For example − Employee name, Product name,
Name of the student, Marks of the student,
Mobile number, Image etc.
Information
Information is the data that has been converted
into more useful or intelligent form.
For example: Report card sheet.
Database
Database is collection of data ,which is
organized in such away that it can be
easily accessed, managed or updated .
DBMS
( Database Management System )
It is software that used to manage -
storage ,access and security of data .
Database 1
Database 2
Examples of DBMS
 •   Microsoft Access
 •   Oracle
 •   MySQL
 •   IBM DB2
 •   SQL Server
 •   SQLite
Purpose of Database
 Data generated       As years passed by
which was recorded    lots and lots of data
     on paper          began to generate
                     which became difficult
                           to manage.
Purpose of Database
As computers came in        To manage this huge
picture tones of digital   amount of digital data
     data began to           database came to
       generate.                 existence.
Purpose of Database
“The main purpose of database is to store the
data electronically.
So that , this stored data can be processed,
and useful information can be derived from
it.”
Applications of database
   Banking
   Airlines and railways
   Sales
   Telecommunications
   Universities.
   Manufacturing
   E-commerce
   Credit card transactions.
   File Systems
        v/s
Database approach
File System Disadvantages :
1. Data Redundancy :
( Some information is duplicated )
For Example – Account dept and Exam dept maintain record of
student, where Rollno, Name ,Address, Phone will get duplicated .
           Rollno                       Rollno
           Name                         Name
           Address                      Address
           Phone                        Phone
           Email                        Exam
           Fees                         result
     Account department              Exam department
File System Disadvantages :
2. Data Inconsistency:
( Different copies of same data are not matching )
Data inconsistency happens if update operation is not performed well
on all the files.
           1001                         1001
           Rahul                        Rahul
           Dadar
            Kurla                       Dadar
           98788990                     98788990
           R@gmail.com                  90 % result
           68,000
     Account department              Exam department
File System Disadvantages :
3. Data Isolation:
Data is scattered in different files , and files may have
different formats . So writing a new application program to
retrieve data is difficult . which result into data isolation
                                                           Isolated
Account department     Exam department      Library department
                 Application
                  Program
File System Disadvantages :
4. Concurrent Access Anomalies ( Problems):
If multiple users are updating data at the same time .
then ,it will result in inconstant data.
Class Teacher
                        Student File
                                               Exam Section
    Account Section
Advantages of DBMS :
1. Independence of Data and Programs :
In DBMS , database can be alerted independently.
2. Controlling Redundancy :
In DBMS , there is no redundancy , If Duplicate
Data is found then DBA can arrange that data in
non duplicate way .
3. Data sharing :
In DBMS , data can be easily share among multiple
users .
4. Data security :
DBA provides access to authorize users only .
File System v/s DBMS
      File System               DBMS
PC based small system   Mainframe based Large
                        system
Cost : Less             Cost : Expensive
Single User System      Multiuser System
Data is isolated        Data is integrated
Transaction concept not Transaction Concept
used                    used
Example :Foxpro         Example :
                        Microsoft Access,
                        Oracle ,MySQL
Characteristics of database
•   Sharing of data .
•   Multiple users can access data.
•   Security.
•   Controlled Redundancy.
Let's Revise !
  1. List 4 Names of DBMS software’s ?
     •   Microsoft Access
     •   Oracle
     •   MySQL
     •   IBM DB2
  2. What is Data Redundancy ?
     • Duplication of data is called Data redundancy
  3. What is Data inconsistency ?
     • Different copies of same data are not
       matching
DBMS vs File System
      File System                  DBMS
PC based small system     Mainframe based Large
                          system
Cost : Less              Cost : Expensive
Single User System         Multiuser System
 Data is isolated        Data is Integrated
Transaction concept not Transaction Concept used
used
 Example : FOXPRO        Example :
                         Microsoft Access,
                         Oracle ,MySQL
Data Abstraction
                                                        Final
                                                       Product
         Table : Student
Hiding complex details of data storage and data organization
from user is called “Data Abstraction”.
For Example : Email in Inbox
Levels of Data Abstraction
There are 3 levels of Data Abstraction
  o View   Level       ( Part of data)
  o Logical Level      ( What data ?)
  o Physical   Level   ( How data ?)
Levels of Data Abstraction
           View Level              Show part of the data to
  View 1      View 2   … View n     user
                                   Complexity is hidden
                                   External view level
                                   What data is stored ?
           Logical Level           Relationship among data
                                   Conceptual level
                                    How data is stored ?
           Physical Level           Complex data structure
                                    Internal level
Example
View 1 :Office        View 2:Teacher     View 3 :Principal
Staff
                                                         View Level
    Table : Student
                                                        Logical Level
                           Hard Disk Drive
                                                      Physical Level
Advantages : Data Abstraction
   It improves the security of the data.
   Multiple users can access their desired
    data.
Think and Answer …
  Identify the level of Data abstraction ?
 How data is stored ?            - Physical Level
 What data is stored ?            - Logical Level
 Show part of the data to user    - View Level
Data Independence
Data independence
   It is ability to modify schema definition at
    one level without affecting a schema
    definition on next level is called “Data
    Independence”
   There are two types of data independence
       •   Physical data independence
       •   Logical data independence.
    Physical Data Independence
   It is ability to change internal level without
    changing conceptual level or external level .
   It is ability to change physical schema without causing
    application programs to be rewritten
                    View Level /
                       External
                    Logical Level/
                     Conceptual
                   Physical Level/                   MODIFY
                      Internal
    Logical Data Independence
   It is ability to change conceptual level without
    changing external level.
   It is ability to change logical schema without causing
    application programs to be rewritten
                   View Level /
                      External
                   Logical Level/                 MODIFY
                    Conceptual
                  Physical Level/
                     Internal
1.2 Database Architecture
       3 Tier
Architecture of DBMS
   3 Tier Architecture of DBMS
User (Presentation) Tier −
          Client
                                  GUI, Web Interface
  Application (Middle) Tier -
                                 Application Programs,
Application Server/ Web Server
                                       Web Pages
    Database (Data) Tier −            Database
       Database Server           Management Systems
                                       (DBMS)
   In 3 tire architecture communication take place from
    client to application server and Application server to
    Database.
   Application server is called “Middle Layer”
   Middle Layer process application code.
   Database server process Database queries.
   3 tire Architecture is used in W.W.W(World Wide Web)
   All client request for data, server gives that data to
    client .
3 Tier Architecture of DBMS
User (Presentation) Tier −
   End-users operate on this tier and they know
    nothing about database.
   At this layer, multiple views of the database can
    be provided by the application.
   All views are generated by applications that reside
    in the application tier.
3 Tier Architecture of DBMS
Application (Middle) Tier -
   Accepts requests from the clients
   Processes the requests and sends        database
    commands to the database server
   Act as intermediate layer between client and the
    database server
3 Tier Architecture of DBMS
Database (Data) Tier −
   At this tier, the database resides along with its
    query processing languages.
   We also have the relations that define the data
    and their constraints at this level.
2 Tier Architecture of DBMS
    2 Tier Architecture of DBMS
   The 2-tier Architecture is based on a client-server
    mechanism.
   In this type of architecture, the applications on
    client-side interact directly with the database
    present at the server-side.
   This interaction between client and server uses
    Application Program Interface like ODBC and JDBC.
   ODBC − Open Database Connectivity
   JDBC − Java Database Connectivity
   When there are a large number of users at client
    side to access the database, this architecture gives
    a poor performance.
   The server side is responsible for delivering the
    functionalities like query processing and
    management of transactions.
   For example − Oracle, Sybase, Microsoft SQL Server
    etc.
2 Tier Architecture of DBMS
    2 Tier Architecture of DBMS
Library system (OLD library system of a college )
Librarian at library counter, directly accesses the database on the server
to enter queries about a book. The database then updates to indicate that
the book is available or no longer available.
1.3 Database Models
Data Model ( 2 Marks )
   Data Model is collection of concept
    which describe structure of database.
   Data Model is collection of data,
    database schema, consistency
    constraints .
Types of Data Model
Object based              Record based
Logical Model             Logical Model
Examples -                 Examples -
• ER Model                 • Network Model
• Object Oriented Model    • Hierarchical Model
• Functional Data Model    • Relational Data Model
Network Model
1.   It is Record Based Logical Model .
2.   It can represent Object and
     Relationship.
3.   It is based on Tree like structure with
     many roots .
4.   Many to many OR One to many
     relationship is maintained .
Network Model
5.   Network Model is more popular .
6.   In this model, data is represented as
     collection of records.
7.   Records have fix formats .
8.   It uses Client Server architecture
Network Model
          “ Object and Relationship ”
 Object                                 Object
                                Relationships
 Network Model
                          One to Many Relationship
01     Sita   Mumbai       CO           C1   Hardware
02     Gita   Pune         IF           C2   Networking
03     Nita   Nashik       EJ           C3   Animation
                                 Many to Many Relationship
     Fix Length Records
“ Tree like structure with many roots .”
Network Model
1.   It is Record Based Logical Model .
2.   It can represent Object and
     Relationship.
3.   It is based on Tree like structure with
     many roots .
4.   Many to many OR One to many
     relationship is maintained .
Network Model
5.   Network Model is more popular .
6.   In this model, data is represented as
     collection of records.
7.   Records have fix formats .
8.   It use Client Server architecture
Key Points to Remember :
Network Model
 1.Record Based Logical Model
 2.Object and Relationship.
 3.Tree like structure
 4.Many to many OR One to many
 5.more popular
 6.records.
 7.fix formats
 8.Client Server architecture
Q. Enlist different types of data
model.( 2 marks)
Answer : Different types of Data model are the
following:
   Hierarchical database model.
   Relational model.
   Network model.
   Entity-Relationship model.
Hierarchical Model
1.   It is based on Tree like structure with
     one root.
2.   Data is stored in the form of parent child
     relationship.
3.   It contains root which is called parent.
4.   It represent one to many relationship
5.   It is not much popular than network
     model .
6.   It is used in Mainframe database system.
Example 1:Hierarchical Model
         Employee Table
 Ename          Eid         Salary
 Mr. Ganesh     111         50000
                                1:N
              Child Name   Date of Birth
              Sita         27/6/2000
              Nita         8/12/2005
                      Child Table
      Figure : ( One to Many )Parent Child Relationship
Hierarchical Model
Difference between
Network and Hierarchical model
       Network Model                     Hierarchical Model
Network Model is more popular        Hierarchical Model is not more
than Hierarchical and Relational     popular
Model
One to Many , Many to many           One to many relationship is
relationship is Maintained           maintained
It is based on Tree like structure   It is based on Tree like structure
with many Roots                      with one Root
Difference between
Network and Hierarchical model
     Network Model      Hierarchical Model
Example              Example
Key Points : Hierarchical
Model
1.   Tree like structure with one root .
2.   parent child relationship.
3.   root is called parent.
4.   one to many relationship
5.   not much popular
6.   Mainframe database system.
Quick Revision
Q1. which database model is represented by
this diagram ?
 Answer : Network Model
 Quick Revision
Q4. Hierarchical Model is based on Tree like
structure with _________.
[ many roots / one root]
Answer : One root
Q3. Hierarchical Model represent many to
many relationship . [ True / False ]
Answer : False
  Quick Revision
    Network Model           Hierarchical Model
Network Model is more       Hierarchical Model is not
popular than Hierarchical   more popular
and Relational Model
 It is based on Tree like   It is based on Tree like
 structure with many        structure with one Root
 Roots
Relational Model
1.   It was introduced by E.F.Codds .
2.   It represent data in the form of table.
3.   A table is a database object that store data
     in the form of rows and columns.
4.   Each row in the table represent collection of
     related data values.
Example of Relational Model
                          Attributes
 Table : Student
   Rollno      Name
     1             Sita           Tuple
     2             Gita
     3             Nita
Concepts of Relational Model
 Table : Student
    Rollno           Name
      1               Sita
      2               Gita
      3               Nita
 1. Tuple - In Relational Model, row is called “Tuple”.
 For example : Tuple         1                Sita
 The above table have 3 Tuples.
 Concepts of Relational Model
    Table : Student
       Rollno           Name
          1              Sita
          2              Gita
          3              Nita
2. Attribute - Column Header is called Attribute .
For example : Student table has two attributes Rollno
and Name .
3. Degree of table – Number of attributes of table is
called “Degree of table”
For Example : Degree of Student Table = 2
 Concepts of Relational Model
     Table : Student
       Rollno           Name
         1               Sita
         2               Gita
         3               Nita
4. Domain - All permissible values are called Domain
For Example : Domain of Rollno are 1,2,3
               Domain of Name are Sita , Gita, Nita .
5. Cardinality – Number of rows in a table is called Cardinality
For Example : Cardinality of Student Table = 3
Activity 1-
  1.   Number of rows in a table
  2.   All permissible values
  3.   Column Header
  4.   Row of the table
  5.   Number of attributes
Tuple                4 . Row of the table
Attribute            3 . Column Header
Degree of table      5 . Number of attributes
Domain               2 . All permissible values
Cardinality          1 . Number of rows in a table
Activity 2- Identify !
Emp_ID   Emp_Name            Emp_Address
1001     Mr. Rahul Mane      Dadar
1002     Mr. Gaurav Tope     Vashi
1003     Mr. Rajesh Patil    Parel
1004     Mr. Ram Kumar       Kurla
Tuple
Attribute                   Emp_ID,emp_Name,Emp_Address
Degree of table               3
Domain                       1001,1002,1003,1004
Cardinality                   4
Database Schema
Schema:
• The overall design of the database is known as schema.
• Database designers design database schemas to help
  programmer to understand the database .
• A schema is defined as structure of database .
For Example : Table –Student
RollNo   Name   Percentage   Branch
The Schema for above student table is :
Student ( RollNo, Name, Percentage, Branch)
Types of Database Schema
The database schemas are partitioned at different level
of abstractions.
Database Schemas are of three types :
   1. Physical Schema
   2. Logical Schema
   3. Subschemas or View Schema
   Types of Schema
1.Physical Schema:
    • The design of database at physical level is called Physical
      Schema.
    • It deals with How data is stored in storage media
    • Data is stored in files and index is maintained
2. Logical Schema:
    • The design of database at Logical level is called Logical
      Schema.
    • It deals with what data is stored and relationship between
      data
    • It defines tables and integrity constraints .
 3. Subschemas or View Schema:
    • The design of database at View level is called View
      Schema or sub schema.
    • Sub schema is subset of schema
    • It describe end user interaction with database
Example of Database Schema
 View Schema       User 1          User 2           User 3
                    view            view             view
                    Student ( Roll_no ,Name ,Project_id)
 Logical Schema
                   Roll_no       Name            Project_id
 Physical Schema
                             Secondary Storage
                                   File
Instance
• The collection of information stored in the databases at
  a particular moment is called as an instance.
• Snapshot of data in the database at given instance of
  time is called Instance.
For Example:
Student table may have following instance
 RollNo   Name   Percentage   Branch
   1      Sita      60          IF
   2      Gita      70          IF
   3      Nita      80          IF
E.F Codd’s Rules
Rule 1 : Information Rule
All information in relational database is represented
by values in a table.
                                         Values
Employee Table
  empid        ename            salary            phone
    1          Sita            5000          89898989
    2          Gita            6000          99999999
Rule 2 : Guaranteed Access Rule
Every data can be easily access by using combination
of table name , primary key value and column name .
Employee Table
empid       ename           salary          phone
 1          Sita           5000         89898989
 2          Gita           6000         99999999
Employee + (empid=2)+ salary
Rule 3 : Systematic treatment of null values
RDBMS handles records that have unknown values (
Null values) .
RDBMS Distinguish between ZERO ( 0 ) and Null Values
.
empid       ename          salary          phone
 1          Sita           5000        89898989
 2          Gita           6000        99999999
 3          Nita             0
                    ZERO                           NULL
Rule 4 : Active online catalogue based on Relationa
Model
Description of the table and Contents of the table can
be queried by DML .
Rule 5 : Comprehensive data sub language Rule
RDBMS supports many languages but at least one of
them should allow user to do following things –
• Define table , view .
• Query and update data set .
• Set Constraints.
   Rule 6 : View updating Rule
Views are the virtual tables created by using queries to
show the partial view of the table.
That is views are subset of table, it is only partial table
with few rows and columns.
This rule states that views are also be able to get updated
as we do with its table.
Rule 7: High level insert, update, delete Rule
A database must support high-level insertion updating
and deletion on a table.
This rule states that every query language used by the
database should support INSERT, DELETE and UPDATE
on the all records.
For Example :
Suppose employees got 5% hike in a year. Then their
salary must be updated to reflect the new salary. A
single query should be strong enough to update the
entire employee’s salary at a time.
Rule 8 : Physical Data Independence
It is ability to modify physical schema without
rewriting application program .
For Example :
If the data stored in one disk is transferred to another
disk, then the user viewing the data should not feel
the difference or delay in access time.
Rule 9 : Logical Data Independence
It is ability to modify conceptual schema without
rewriting application program .
For Example :
If we split the EMPLOYEE table according to his
department into multiple employee tables, the user
viewing the employee table should not feel that these
records are coming from different tables.
Rule 10 :Integrity Independence
A database must be independent of the application that
use it .
Integrity constraints can be changed without changing
application program .
 Rule 11 :Distribution Independence
Application program are not affected by change in
distribution of Physical data.
For Example :
The end user should not be able to know about the
database servers. He should be able to get the records as
if he is pulling the records locally. Even if the database is
in different servers, the accessibility time should be
comparatively less.
 Rule 12 : No Subversion Rule
The language that access the information should not
bypass the integrity constraint.
For Example :
Update Student’s address query should always be
converted into low level language which updates the
address record in the student table only . It should not
be updating any other record other than that .
Overall Architecture of Database
    Query Processor: It interprets the requests received from
    user.
    Query Processor contains the following components –
     DML  Compiler: It processes the DML statements into low
      level instruction (machine language), so that they can be
      executed.
     DDL   Interpreter: It processes the DDL statements
     Embedded DML Pre-compiler: It processes DML statements
      embedded in an application program into procedural calls.
     QueryOptimizer: It executes the instruction generated by
      DML Compiler.
Storage Manager: Storage Manager is a program that
provides an interface between the data stored in the
database and the queries received.
Authorization Manager: It ensures role-based access control, i.e,.
checks whether the particular person is privileged to perform the
requested operation or not.
Integrity Manager: It checks the integrity constraints when the
database is modified.
Transaction Manager: It controls concurrent access by performing the
operations in a scheduled way that it receives the transaction.
File Manager: It manages the file space and the data structure used to
represent information in the database.
Buffer Manager: It is responsible for cache memory and the transfer of
data between the secondary storage and main memory.
Disk Storage: It contains the following components –
•Data Files: It stores the data.
•Data Dictionary: It contains the information about the structure of any
database object. It is the repository of information that governs the
metadata.
•Indices: It provides faster retrieval of data item.