Basic Concepts
Course Code: CSC 2108     Course Title: Introduction To Database
                    Department of Computer Science
                   Faculty of Science and Technology
Lecture No:   03          Week No:     02               Semester:   spring 22-23
Lecturer:     SIFAT RAHMAN AHONA
Lecture Outline
 Database Management System (DBMS)
 Application of Database
 Drawbacks of File System
 View of Data
 Level of Abstraction
 Schema and Instance
 Data Independence
 Data Models
 Database Languages: DML , DDL, SQL
 Database Design
 Storage Management
 Database Users
 Database Administrators
Database Management System(DBMS)
 Contains information about a particular enterprise
      Collection of interrelated data
      Set of programs to access the data
      An environment that is both convenient and efficient to
       use
Application of Database
 •   Banking: all transactions
 •   Airlines: reservations, schedules
 •   Universities: registration, grades
 •   Sales: customers, products, purchases
 •   Manufacturing: production, inventory, orders, supply chain
 •   Human resources: employee records, salaries, tax
     deductions
Drawbacks of Using File System for Data
Storage
 • Data Redundancy and Inconsistency
 • Difficulty in Accessing Data
 • Data Isolation
 • Integrity Problems
 • Atomicity of updates
 • Concurrent access by multiple users
 • Security problems
                                                                             6
Drawbacks of Using File System for Data
                                Storage
 •   Data Redundancy and            •   Data Isolation
     Inconsistency                      -> Multiple files and formats
     ->Multiple file formats            -> Difficult if we write different
     ->duplication of information       parts in different programming
         in different files             language.
 •   Difficulty in Accessing        •   Integrity Problems
     Data                               ->Integrity
                                            constraints/rule/condition
     ->Need to write a new                  (e.g. account balance > 0)
        program to carry out                become “buried” in program
        each new task                       code rather than being stated
                                            explicitly
                                        ->Hard to add new constraints or
                                           change existing ones
                                                                            7
Drawbacks of Using File Systems for Data
Storage
 • Atomicity of            • Concurrent access by • Security problems
   updates                    multiple users             ->Hard to provide
  ->Failures may leave        ->Concurrent accessed        user access to
     database in an             needed for                 some, but not all,
     inconsistent state         performance                data
     with partial             ->Uncontrolled
     updates carried            concurrent accesses
     out                        can lead to
     Example: Transfer          inconsistencies
     of funds from one          Example: Two people
     account to                 reading a balance
     another should             and updating it at
     either complete or         the same time
     not happen at all
  Database systems offer solutions to all of the problems that have been
    mentioned
View of Data
•Database system is a collection of interrelated data and a set of
programs to access and modify these data
•Major purpose of a database system is to provide users with an
abstract view of the data
• The system hides certain details of how data are stored and
maintained
Levels of Abstraction
•Physical Level
•Logical Level
•View Level
                                                                                      10
Levels of Abstraction
    Since many database-system users are
    not computer trained, developers
    hide the complexity from users  Logical level:
    through several levels of abstraction,  Next higher level
    to simplify users interaction with the  Describes what data are stored
    system.
                                                     in database, and the
                                                    relationships among the data
    Physical level:
        Lowest level
        describes how a record (e.g.,
         customer) is stored                    View level:
        Complex low level data structures        Application programs hide
                                                     details of data types
                                                  Views can also hide information
                                                     (such as an employee’s salary)
                                                     for security purposes
Schema and Instance
Schema – the logical structure of the database
 •   Example: The database consists of information about a set of customers and
     accounts and the relationship between them
 •   Analogous to type information of a variable in a program
 •   Physical schema: database design at the physical level
 •   Logical schema: database design at the logical level
Instance – the actual content of the database at a particular point
in time
 •   Analogous to the value of a variable
Data Independence
Physical Data Independence – the ability to modify the physical
schema without changing the logical schema
 •   Applications depend on the logical schema
 •   In general, the interfaces between the various levels and components should be well
     defined so that changes in some parts do not seriously influence others
Logical Data Independence - the ability to modify the logical
schema without causing application programs to be rewritten.
 •   Required when the logical structure has been altered
Data Models
A collection of tools for describing
     Data
     Data relationships
     Data semantics (Logical and Lexical)
     Data constraints
 Data Models
 Relational Model , ER Model and Other Data Models
•The relational model uses a collection of tables to represent both
data and the relationships among those data.
•The E-R data model is based on a perception of a real world that
consists of a collection of basic objects, called entities and of
relationships among these objects.
•Object-based data models (Object-oriented and Object-
relational)
•Semi-structured data model (XML)
•Otherolder models:
         Network model
        Hierarchical model
Database Language
DML
Stands for Data Manipulation Language
DML OPERATIONS: INSERT, UPDATE, DELETE, MERGE
Language for accessing and manipulating the data organized by the
  appropriate data model
      DML also known as query language
Type of access are:
       Retrieval of information stored in the database
       Inserting of new information into the database
       Deletion of information from the database
       Modification of information stored in the database
Database Language
DDL
Stands for Data Definition Language (DDL)
Data dictionary contains metadata (i.e. data about data)
DDL OPERATIONS: CREATE, ALTER, DROP, RENAME,
  TRUNCATE
Database Language
SQL
Widely used non-procedural language
SQL is used to communicate with a database
Database Design
Logical and Physical Design
The process of designing the general structure of the database:
 Logical Design – Deciding on the database schema. Database design
  requires that we find a “good” collection of relation schemas.
       Business decision – What attributes should we record in the
         database?
       Computer Science decision – What relation schemas should
         we have and how should the attributes be distributed among
         the various relation schemas?
 Physical Design – Deciding on the physical layout of the database
Storage Manager
Components
 Storage manager 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 storage manager is responsible to the following tasks:
       Interaction with the file manager
       Efficient storing, retrieving and updating of data
 Components of Storage Manager
      Authorization and integrity manager
      Transaction manager
      File manager
      Buffer manager
                                                                                           20
Storage Manager
 Authorization and Integrity Manager: Checks the authority of users to access data.
 Transaction manager: Ensure that the database in a consistent state despite system
   failures, and that concurrent transaction execution proceed without conflicting.
 File manager : Manage allocation of space on disk storage and the data structures
   used to represent information stored on disk.
 Buffer manager : Responsible for fetching data from disk storage into main memory
   and decide what data to cache in main memory. The data buffer manager is a critical
   part of the database system, since it enables the database handle data sizes that are
   much larger than the size of main memory.
 Storage Manager
 Data Structure
The storage manager implements several data structure 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: Provide first access to the data items. Like index of the
textbook.
Database Users
Types
Users are differentiated by the way they expect to interact with
the system
  • Application programmers
  • Sophisticated users
  • Specialized users
  • Naive users
                                                                                                  23
Database Users
   Users are differentiated by the way they      Specialized users
   expect to interact with the system               One type of sophisticated user
                                                    Write specialized database applications
 Application programmers
                                                      that do not fit into the traditional data
    Computer professionals who write
                                                      processing framework (expert system,
      application programs                            knowledge base, graphics data, audio
    Can use RAD tools for constructing forms         data)
      and reports with minimal programming
      efforts.                                   Naive users
                                                    Invoke one of the permanent application
 Sophisticated users
                                                      programs that have been written
    Interact with the system without writing         previously
      programs                                      Read reports
    Form requests in a database query              Examples, people accessing database
      language                                        over the web, bank tellers,
    Submit query to the query processor
    Analyst
Database Administrator
Duties
 Coordinates all the activities of the database system; the database
  administrator has a good understanding of the enterprise’s information
  resources and needs.
 Database administrator's duties include:
       Schema definition : The DBA create the original database schema by
         executing a set of data definition statements in the DDL
       Storage structure and access method definition
       Schema and physical organization modification
       Granting user authority to access the database
       Specifying integrity constraints
       Acting as liaison with users
       Monitoring performance and responding to changes in requirements
Books
1. Modern Database Management (Sixth Edition) by Fred R. McFadden, Jeffrey A.
   Hoffer, Mary B. Prescott
2. Database System Concepts (Fifth Edition) by Henry F. Korth, S. Sudarshan, A.
   Silberschatz
3. Oracle-database-10g-sql-fundamentals-1-student-guide-volume-1
4. SQL and Relational Theory: How to Write Accurate SQL Code by C.J. Date
5. Database Systems: A Practical Approach to Design, Implementation and
   Management (4th Edition) by Thomas M. Connolly, Carolyn E. Begg
6. Fundamentals of Database Systems, 5th Edition by RamezElmasri, Shamkant B.
   Navathe
7. Database Design and Relational Theory: Normal Forms and All That Jazz by C. J. Date
8. An Introduction to Database Systems 8th Edition, by C.J. Date
References
1. https://www.db-book.com/db6/slide-dir/index.html
2. https://docs.oracle.com/en/database/oracle/oracle-database/20/sqlrf/SQL-Sta
   ndards.html#GUID-BCCCFF75-D2A4-43AD-8CAF-C3C97D92AC63
3. https://www.slideshare.net/HaaMeemMohiyuddin1/data-knowledge-and-infor
   mation
4. https://www.slideshare.net/tabinhasan/from-data-to-wisdom
5. https://www.slideshare.net/thinnaphat.bo/