CSC241 Database Systems
Lecture # 6
         By
      Maria Gul
                          1
Schemas
• External Schemas
   ❖Also called subschemas.
   ❖Multiple schemas per database.
   ❖Corresponds to different views of data.
• Conceptual Schema
   ❖Describes all the entities, attributes, and
    relationships    together    with       integrity
    constraints.
   ❖Only one schema per database.
Schemas
• Internal Schema
   ❖A complete description of the internal model,
    containing the definitions of stored records, the
    methods of representation, the data fields, and
    the indexes and storage structures used.
   ❖Only one schema per database.
Mapping
• The DBMS is responsible for mapping between these three types
  of schema:
  • The DBMS must check that each external schema is derivable from
    the conceptual schema, and it must use the information in the
    conceptual schema to map between each external schema and the
    internal schema
• Types of mappings
  • Conceptual/Internal mapping
  • External/Conceptual mapping
Conceptual/Internal Mapping
• Enables the DBMS to
   ❖Find the actual record or combination of
    records in physical storage that constitute a
    logical record in the conceptual schema,
   ❖Together with any constraints to be enforced
    on the operations for that logical record.
   ❖ It also allows any differences in entity names,
    attribute names, attribute order, data types,
    and so on, to be resolved.
External/Conceptual
Mapping
• Enables the DBMS to
   ❖Map names in the user’s view on to the
    relevant part of the conceptual schema.
7
Data Independence
• Outcome of three level architecture is data
  independence.
• Change in lower level do not affect the
  upper level.
• Type of data Independence
  ❖Logical Data Independence
  ❖Physical data Independence
                                                8
  Logical Data Independence
• Changes in conceptual model do not affect
 external view.
• Logical   data   independence     is   the
 Immunity/resistance of the external schema
 to changes in the conceptual schema.
• Example
  ❖Adding new file
  ❖Adding new fields
  ❖Change the type of Attribute
  ❖Delete the Attribute                        9
   • Physical data Independence
• Changes in Internal model do not affect
  conceptual model.
• Physical    data     independence   is    the
  Immunity/resistance of the conceptual schema
  to changes in the Internal schema.
• Example
   ❖Changing in file organization
   ❖Index Implementation
   ❖Using different storage devices
                                                  10
Data Independence and the ANSI-
SPARC Three-Level Architecture