1. Gyanastra
  2. Database Systems
  3. UGC NET: Database Concepts and Architecture
  4. Data Models Schemas and Instances
Free lesson, no account needed 11 min read 26 practice questions after it
Asked in past papers2 times
  • ISRO2017
  • UGC NET2005

Database Systems · UGC NET: Database Concepts and Architecture

Data Models Schemas and Instances

Overview

A data model supplies the concepts used to describe data, relationships, semantics and constraints; a schema is the actual description of a database written using such concepts; and an instance is the data stored at a particular moment.
This lesson sits in the core Database Concepts and Architecture area and is the base for ER modelling, relational design, the three-schema architecture, the data dictionary/catalog, and data independence.
Before studying it, you should know what a relation/table, attribute, tuple, key and constraint mean. The conventions used here follow Elmasri–Navathe unless a question states otherwise.

Key concepts

  • A data model is an integrated collection of concepts for describing data, relationships, meaning and consistency constraints. It also provides operations for retrieval and update. It is not the same as a schema.
  • High-level or conceptual data models provide concepts close to user perception: the ER model and, in the Elmasri–Navathe convention used here, object data models such as the ODMG object model. They describe entities/objects, attributes, relationships and constraints without storage detail.
  • Representational or implementation data models are understandable to end users but close to physical implementation: the relational model, network model and hierarchical model.
  • Physical or low-level data models describe storage: record formats, file organisations, indexes, hashing and access paths.
  • A database schema is the description of a database structure. It is the intension of the database and includes data elements, record/relation types, attributes, domains, relationships, keys and constraints.
    A schema diagram displays structure only, not actual data.
  • An instance, also called a database state, snapshot or occurrence, is the actual data at a particular moment. It is the extension of the schema and changes frequently.
  • A valid database state is one that satisfies every constraint specified in the schema. The schema defines the set of all possible valid states; the DBMS must ensure that every state after an operation is valid.
  • The data dictionary or database catalog stores metadata: relation names, attribute names and data types, constraints, storage structures, access paths, statistics and user authorisation privileges.
    It is itself stored as system relations and can be queried.
  • Metadata is data about data, such as table names, column types and privileges. Actual rows, such as marks or balances, are user data.
  • Normalization organises relations to reduce redundancy and update anomalies. Referential integrity requires a foreign-key value to match an existing primary-key value or be null.
    An external schema defines a particular user’s view.
  • The ANSI/SPARC three-schema architecture has three levels: external schema (individual user view), conceptual schema (community logical view) and internal schema (physical storage view).
    Mappings exist between external/conceptual and conceptual/internal schemas.
  • The external level hides irrelevant or sensitive data from a user, for example hiding a manager’s salary from an ordinary employee view. This is external-level data hiding.
  • The conceptual/logical level describes what data are stored and their relationships/constraints. The internal/physical level describes how data are stored.
  • Schema DDL (Data Definition Language) lets the DBA define or modify schema components. Old papers sometimes misprint DLL; read it as DDL. DML manipulates instances.
  • Logical data independence is the ability to change the conceptual schema without changing external schemas or application programs.
    Physical data independence is the ability to change the internal schema without changing the conceptual schema. Logical data independence is harder.
  • Indexes are auxiliary access structures stored under the internal schema; they improve retrieval performance and accessibility.
  • In a hierarchical model, data form a tree: each child record has one parent, relationships are parent-child pointers, and retrieval normally starts at the root.
    Hashing may be used to locate the root quickly, then pointers navigate the tree.
  • In the network model, especially CODASYL DBTG, data form a graph of record types connected by sets. A set has one owner and many members, and a record type can participate in several sets, so many-to-many relationships are possible.
    CODASYL produced an early database standard.
  • DBTG set retention classes are FIXED, MANDATORY and OPTIONAL. A FIXED member cannot be reconnected to another owner, so the network DML command RECONNECT is not used with a FIXED set.
  • An ER diagram is a tool for representing a conceptual data model; it is not a transaction model or a process model.
  • DBMS-enforced constraints are declared in the schema and stored in the catalog. If a check is hard-coded only in an application program, the DBMS itself does not know or enforce it for all updates.

How it works

  1. Choose a data model appropriate to the task: ER/object for conceptual design, relational for implementation, physical model for storage decisions.
  2. Design the schema: name relation/record types, attributes, domains, keys, relationships and constraints. Store this description in the catalog.
  3. Create an initial instance by loading data. Every inserted row must satisfy the schema constraints; otherwise it is rejected.
  4. During operation, DML statements change the instance. After each change, the DBMS checks constraints; a valid state remains valid only if the new data obey the schema.
  5. Build external schemas for different user groups. Map each external schema to the conceptual schema, and the conceptual schema to the internal schema.
  6. If storage changes, only the internal schema and conceptual/internal mapping change: this gives physical data independence. If the conceptual schema changes without changing external schemas, this gives logical data independence.
  7. A schema change is made by DDL and occurs rarely; an instance change is made by DML and occurs frequently.
Figure. Notice that the DBMS checks constraints after a user transaction: a valid change becomes a new valid state and returns to user transactions, while an invalid change is rejected. Schema is stored in the catalog before loading the initial instance.

Worked examples

Example 1 — schema versus instance. A relation is declared as Student(stuid, name, course, marks). The current rows are (1, Kavita, 5, 88), (2, Imran, 5, 88), (3, Deepa, 4, 95). Which part is schema and which is instance?
The schema is Student(stuid, name, course, marks) plus its keys and constraints. The three rows are the instance. Adding a new column gender is a schema change; changing Kavita’s marks from 88 to 90 is an instance change.

Example 2 — match the columns. Match A External schema, B Conceptual schema, C Internal schema, D Data model with (i) concepts for describing data, (ii) physical storage structures, (iii) user view, (iv) community logical view.
A–iii, B–iv, C–ii, D–i. The external schema is the user view; the conceptual schema is the logical community view; the internal schema is storage; a data model supplies concepts.

Example 3 — numeric two-step. A relation R(A, B, C) has 4 tuples. The DBA adds attribute D with default value 0, then inserts 3 tuples, then deletes 1 tuple. Find the final degree and cardinality.
Initially degree = 3, cardinality = 4. Adding D changes the schema: degree becomes 4, and existing 4 tuples get D = 0; cardinality remains 4. Inserting 3 tuples makes cardinality 7. Deleting 1 tuple makes cardinality 6. Final degree = 4, final cardinality = 6.

Example 4 — assertion and reason. Assertion A: A valid database state must satisfy the constraints in the schema. Reason R: The schema declares constraints that every state must obey.
Both A and R are true, and R correctly explains A. The schema permits many possible valid states; the current state is only one of them. A state satisfying constraints is valid but need not be the present state.

Example 5 — data independence. A DBA moves a file to a new disk and changes an index, but external schemas and application programs still work. This is physical data independence.
Later, a new attribute is added to the conceptual schema while existing external schemas still work. This is logical data independence. If only the internal schema is changed, no external schema is affected.

Comparison

ConceptMeaningChangesExample
Data modelSet of concepts and rules for describing data and operationsRarelyRelational model, ER model
SchemaDescription of database structure using a modelInfrequentlyStudent(stuid, name, course, marks)
InstanceActual data at a momentFrequentlySpecific student rows
CatalogMetadata repositoryAs schema/storage/privileges changeSystem tables storing table definitions
Level/schemaDescribesMain userHides
External schemaUser-specific viewEnd user/applicationConceptual and physical details; sensitive data
Conceptual schemaLogical structure, relationships, constraintsDBA/communityPhysical storage details
Internal schemaStorage structures, files, indexes, access pathsSystem/DBALogical and user views
Data model categoryCloseness to userExamplesMain use
High-level/conceptualVery closeER model, object modelConceptual design
Representational/implementationUnderstandable and implementableRelational, network, hierarchicalLogical/implementation design
Physical/low-levelClose to storageFile formats, indexes, hashingStorage design
ModelStructureRelationship handlingRetrieval
HierarchicalTreeOne parent per childStart at root; pointers downward
Network/CODASYLGraphSets with owner/member; multiple owners possibleNavigate sets
RelationalTablesForeign keysDeclarative SQL
IndependenceChange allowedUnchanged
Physical data independenceInternal schemaConceptual schema
Logical data independenceConceptual schemaExternal schemas/applications

Revision summary

  • Schema = intension; instance = extension.
  • Schema changes rarely; instance changes frequently.
  • Valid state satisfies schema constraints; current state is one valid state.
  • Catalog stores metadata: names, types, constraints, storage, privileges.
  • External = user view; conceptual = what data; internal = how stored.
  • External schema can hide salary and other sensitive columns.
  • Schema DDL defines schema; DML changes instance.
  • Physical independence: internal change, conceptual unchanged.
  • Logical independence: conceptual change, external unchanged; harder to achieve.
  • High-level = ER/object; representational = relational/network/hierarchical; physical = storage.
  • Hierarchical is tree; network is graph with CODASYL sets.
  • FIXED set member cannot be reconnected; hashing can locate hierarchical root.

Previous-year exam insights

  • Direct definition questions ask whether a term is schema, instance, data model, catalog, external/conceptual/internal schema, or logical/physical level; identify the exact level first.
  • Statement I/II questions test schema-vs-instance, valid-vs-current state, and logical-vs-physical data independence.
    Schema changes are infrequent, instance changes frequent; logical independence is harder.
  • Match-the-list questions commonly pair external schema with user view, conceptual schema with logical description, internal schema with storage, data dictionary with metadata, normalization with redundancy reduction, referential integrity with primary-foreign key matching.
  • Assertion–reason questions test whether the relational model is representational rather than conceptual, whether constraints are stored in the catalog, and whether many valid states can exist for one schema.
  • Numeric questions test degree/cardinality after DDL and DML: adding an attribute changes degree; inserting/deleting tuples changes cardinality; default values fill existing tuples.
  • ER-diagram questions expect “data model/conceptual model”, not process or event model.
  • In mixed SQL situations, remember that a query sees the current instance. > ANY means greater than at least one value, not greater than all; NOT EXISTS with >= can mishandle ties and can include rows outside the target group.
    Restrict the outer table to the target group and use >= ALL or MAX for highest-value queries.
  • Check whether the question asks for the schema-level rule or the current data value; many wrong options confuse metadata with user data.

Practice at PARIKSHA

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

  1. Define data model, schema, instance, valid state and catalog without mixing them.
  2. Classify ER, object, relational, network, hierarchical and physical models correctly.
  3. Explain the three-schema architecture and the role of each mapping.
  4. Distinguish logical data independence from physical data independence with examples.
  5. Identify which items in the catalog are metadata and which are user data.
  6. Compare hierarchical and network models on structure, root/parent-child pointers, sets and many-to-many support.
  7. Work out degree and cardinality after adding attributes, inserting tuples and deleting tuples.
  8. Explain external-level data hiding and why external schema is used for security/views.
  9. Answer statement, match, assertion–reason and numeric questions on schemas, states and constraints.
  10. Detect SQL traps involving ANY, ALL, NOT EXISTS and highest-value queries.

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

Pages 1–2 of 2