1. Gyanastra
  2. Database Systems
  3. UGC NET: Database Concepts and Architecture
  4. Three Schema Architecture and Data Independence
Free lesson, no account needed 10 min read 28 practice questions after it
Asked in past papers8 times
  • GATE CSE1994
  • ISRO20182007
  • UGC NET20142013201220072006

Database Systems · UGC NET: Database Concepts and Architecture

Three Schema Architecture and Data Independence

Overview

The three-schema architecture is the standard framework, based on the ANSI/SPARC model, for separating how a database is seen by different users, how it is logically defined for the whole organisation, and how it is physically stored.
It explains data abstraction and data independence, two ideas that decide whether a DBMS can change storage or logical design without breaking application programs.
This lesson covers the external, conceptual and internal schemas, the two mappings between them, views, the data dictionary, and the exact meaning of logical and physical data independence.
You need basic ideas of tables, records, files, indexes, DDL and DML before studying it.

Key concepts

  • ANSI/SPARC means American National Standards Institute / Standards Planning and Requirements Committee. Its architecture is also called the three-level architecture or three-schema architecture.
  • A schema is a formal description of database structure: data elements, record/table structures, relationships and constraints. It is not the current data itself.
  • An instance is the actual data stored in the database at a particular moment. Schema is intension; instance is extension.
  • External schema is the user view or subschema. It describes the part of the database relevant to a user group. There can be many external schemas.
    A view is a common external-schema object: a virtual relation defined by a query, acting as a window on selected rows and columns.
  • Conceptual schema is the logical schema or community view. It describes the entire database logically for the organisation: entities, attributes, relationships, constraints and integrity rules.
    It does not describe physical storage.
  • Internal schema is the physical schema or storage schema. It describes file organisation, storage structures, indexes, access paths, block placement, compression and other physical details.
  • External/conceptual mapping translates each external view to the corresponding conceptual objects. It supports logical data independence.
  • Conceptual/internal mapping translates the conceptual schema to stored records, files and access paths. It supports physical data independence.
  • There is no direct external/internal mapping in the standard architecture. A user request passes through external/conceptual and then conceptual/internal mapping.
  • Logical data independence is the ability to change the conceptual schema without changing external schemas or application programs. It is harder because applications depend on logical structures such as columns and tables.
  • Physical data independence is the ability to change the internal schema without changing the conceptual schema or application programs. It is easier because storage details are hidden from applications.
  • A data dictionary or system catalog stores metadata: schema definitions, mappings, constraints, users, privileges and statistics. It is not ordinary user data. DDL statements update it.
  • DDL defines schema components; DML manipulates data. Some texts also use subschema DDL or a view definition language for external schemas.
  • Hierarchical and network models are navigational and expose record pointers and structures; they provide poor data independence.
    The relational model is designed to provide both logical and physical data independence, though physical independence is easier in practice.
  • Indexes are auxiliary access-path structures maintained at the internal level. They improve retrieval performance and accessibility, but they are not part of the conceptual meaning of the data.

How it works

The three schemas are three different descriptions of one database, not three separate copies of the data. Only the internal level corresponds to stored data; external and conceptual schemas are descriptions and views.

  1. The DBA uses schema DDL to define the conceptual schema: tables, attributes, keys, relationships and constraints. These definitions go into the data dictionary.
  2. The DBA defines the internal schema: file organisation, indexes, access methods and storage details.
  3. The DBMS records the conceptual/internal mapping between logical objects and physical storage.
  4. For each user group, the DBA defines an external schema, often using views. The DBMS records an external/conceptual mapping from each view to conceptual objects.
  5. A user or program sends a query or update using its external schema.
  6. The DBMS checks authorisation and consults the data dictionary.
  7. The external/conceptual mapping converts the user’s view request into conceptual-schema objects.
  8. The conceptual/internal mapping converts conceptual objects into stored records, files and access paths.
  9. The storage engine retrieves or updates data. Results are converted back through the mappings and presented through the external schema.

For data independence, remember the direction of protection:

  • To change the internal schema safely, adjust only the conceptual/internal mapping. Users still see the same conceptual and external schemas. This is physical data independence.
  • To change the conceptual schema safely, adjust the external/conceptual mapping so that existing views still produce the required external schema. This is logical data independence.
  • If a conceptual change is destructive — for example, deleting a column that an application needs — no mapping can hide the loss. Data independence is a design goal, not a magical guarantee.
  • When a new external schema is created, a new external/conceptual mapping is added even if the conceptual schema is unchanged.
  • If a database has EE external schemas, one conceptual schema and one internal schema, there are EE external/conceptual mappings plus one conceptual/internal mapping. There is no direct external/internal mapping.
Figure. Notice the two mappings translate requests between external views, conceptual objects, and stored records. The data dictionary links to the external-conceptual mapping, conceptual schema, conceptual-internal mapping, and internal schema.

Worked examples

Example 1 — direct concept.
A DBMS keeps a description of B+ tree indexes, hash files and block placement. Which schema level is this?

  1. These are storage and access-path details.
  2. Such details belong to the internal schema, also called the physical schema.
    Answer: Internal schema.

Example 2 — physical independence.
Harish, the DBA, changes the ORDERS table from heap file organisation to a B+ tree primary index and adds a secondary index. No conceptual or external schema is changed. Which independence is used, and which mapping is affected?

  1. File organisation and indexes are internal-schema details.
  2. The change is hidden by the conceptual/internal mapping.
  3. The conceptual schema and all external schemas remain the same.
    Answer: Physical data independence; the conceptual/internal mapping is affected, not the external/conceptual mapping.

Example 3 — external data hiding.
Geeta works in HR. She needs employee names and departments but must not see salaries. The DBA creates EMP_HR(Name, Dept) as a view over EMPLOYEE. Which level hides the salary?

  1. A view is an external schema object.
  2. It shows only selected columns and rows to a particular user group.
    Answer: The hiding is at the external level; the view is a window into part of the database.

Example 4 — statement type.
Statement I: Logical data independence is generally harder to achieve than physical data independence.
Statement II: Physical data independence is achieved by the external/conceptual mapping.

  1. Statement I is true: application programs are written against the conceptual/logical structure, so conceptual changes are harder to hide.
  2. Physical data independence is achieved by the conceptual/internal mapping, not by external/conceptual mapping. So Statement II is false.
    Answer: Statement I true, Statement II false.

Example 5 — mapping count.
A database has 3 external schemas, 1 conceptual schema and 1 internal schema. Every external schema is mapped to the conceptual schema, and the conceptual schema is mapped to the internal schema. How many mappings exist?

  1. Each external schema needs one external/conceptual mapping: 33.
  2. There is one conceptual/internal mapping: 11.
  3. There is no direct external/internal mapping.
    Total =3+1=4=3+1=4.
    Answer: 4 mappings.

Comparison

Schema levelAlso calledMain contentsNumberKey mapping
ExternalUser view, subschemaViews, allowed rows/columns for user groupsManyExternal/conceptual
ConceptualLogical schema, community viewEntire logical structure, constraints, relationshipsOneExternal/conceptual and conceptual/internal
InternalPhysical schema, storage schemaFiles, indexes, access paths, storage detailsOneConceptual/internal
PointLogical data independencePhysical data independence
Change allowed without affecting higher levelConceptual schema may changeInternal schema may change
Protected levelExternal schemas and application programsConceptual schema and application programs
Mapping usedExternal/conceptual mappingConceptual/internal mapping
DifficultyHarderEasier
ExampleSplit a table, add a column, change constraintsChange file organisation, add an index, change storage device
TrapIt is not achieved by conceptual/internal mappingIt is not achieved by external/conceptual mapping
TermMeaning
SchemaDesign or description of structure
InstanceActual data at a given time
ViewVirtual external-schema relation defined by a query
Data dictionaryMetadata repository for schemas, mappings, constraints and privileges

Revision summary

  • External = views; conceptual = logical whole; internal = storage.
  • Only one database is physically stored; the three schemas are descriptions, not three copies.
  • External/conceptual mapping gives logical data independence.
  • Conceptual/internal mapping gives physical data independence.
  • Mnemonic: “External users are logical; internal storage is physical.”
  • File organisation and indexes are internal-level changes.
  • Splitting tables or adding/removing columns is conceptual-level change.
  • A view is a window into selected data and belongs to the external level.
  • Multiple external schemas are allowed; normally one conceptual and one internal schema.
  • For EE external schemas, total mappings =E+1=E+1.
  • Physical independence is easier; logical independence is harder.
  • Hierarchical and network models offer poor data independence; the relational model aims for both.

Previous-year exam insights

  • Direct questions ask which schema describes storage, which describes the whole logical database, and which hides data from a user.
    Check whether the clue is storage, organisation-wide logic, or user visibility.
  • Mapping questions are common: external/conceptual = logical independence, conceptual/internal = physical independence. Reversing them is the main trap.
  • Statement I/II questions often mix a true fact about logical independence being harder with a false claim about which mapping achieves it.
  • Assertion–reason questions test whether application programs are written against the conceptual schema and whether storage details are hidden from them.
  • Match-the-list questions ask for responsibilities: external schema, conceptual schema, internal schema, external/conceptual mapping, conceptual/internal mapping, data dictionary.
  • Scenario questions give a DBA action such as adding an index or splitting a table; first classify the action as internal or conceptual, then decide the independence type.
  • Watch language such as “suffers from data independence”. In older papers it means lacks or poorly supports data independence; answer from the standard definitions, not from the loose phrase.
  • Do not confuse a view with a query or a schema. A view is a stored definition of a virtual relation, not the query result itself.

Practice at PARIKSHA

You are ready for the PARIKSHA tests of this sub-topic when you can:

  • name and define the external, conceptual and internal schemas without confusing their responsibilities;
  • identify the schema affected by a change such as a new index, a new file organisation, a new view, or a split table;
  • state which mapping supports logical independence and which supports physical independence;
  • calculate the number of mappings for a given number of external schemas;
  • explain why logical data independence is harder than physical data independence;
  • distinguish schema, instance, view and data dictionary;
  • explain how a user query passes from an external view through both mappings to stored data;
  • identify external-level data hiding in questions about salaries, permissions or restricted views;
  • evaluate statement-type and assertion–reason questions by checking definitions, not by memorising phrases.

Attempt the sub-topic test first, then the subject test.

Pages 1–2 of 2