Database Introduction

#Purpose of Database:

Drawbacks of using file systems to store data:

  • Data redundancy and inconsistency
    • Multiple file formats, duplication of information in different files
  • Difficulty in accessing data
    • Need to write a new program to carry out each new task
  • Data isolation
    • multiple files and formats
  • Integrity problems
    • Integrity constraints become "burned" in program code rather than being stated explicitly.
    • Hard to add new constraints or change existing ones
  • Atomicity of updates
    • Failures may leave database in an inconsistent state with partial updates carried out
    • Example: Transfer of funds from one account to another should either complete or not happen at all
  • Concurrent access by multiple users
    • Concurrent accessed needed for performance and usability
    • Uncontrolled concurrent access can lead to inconsistencies
      • Example: Two people reading a balance and updating it at the same time
  • Security problems
    • Hard to provide user/apps access to some, but not all, data

Modern database systems offer solutions to all the above problems

#Instances and Schemas

Similar to types and variables in programming languages

Schema - the logical structure of the database

  • Example: The database consists of information about a set if 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 logical level

Instance - the actual content of the database at a particular point in the time

  • Analogous to the current values of a set of variables

Physical Data Independence - the ability to modify the physical schema without changing the logical schema

  • Applications depend on the logical schema(or the view level 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.