8.2.2 Data Dictionaries and DBMS Tools
A DBMS needs an accurate description of its own database before it can create tables, check queries or enforce structural rules. It stores this description as metadata in a data dictionary and provides software tools that let developers define structures and users submit queries.
By the end of this section, you should be able to:
- Distinguish data from metadata.
- Explain the purpose of a data dictionary.
- Identify the kinds of structural information stored in a data dictionary.
- Explain how a DBMS keeps dictionary entries consistent with the database schema.
- Describe how a developer interface is used to create and modify database structures.
- Describe how a query processor checks and executes a database request.
- Explain how the data dictionary, developer interface and query processor work together.
Data and Metadata
The values stored in a table are data. The descriptions that tell the DBMS what those values mean and how they must be stored are metadata.
This lesson uses an original database for a school makerspace that lends equipment to students and staff.
| Example | Data or metadata? | Reason |
|---|---|---|
EQ-417 |
Data | A value stored for one equipment item. |
EquipmentID |
Metadata | The name of an attribute. |
VARCHAR(8) |
Metadata | Describes the permitted type and maximum size of the attribute. |
Thermal camera |
Data | A stored equipment name. |
PRIMARY KEY |
Metadata | Describes the role and constraint applied to an attribute. |
TRUE in the Available field |
Data | A current value for one tuple. |
The Data Dictionary
A data dictionary is the DBMS-managed collection of metadata describing the database. It provides one authoritative source for structural definitions.
The dictionary may describe tables, attributes, views, keys, relationships, constraints and indexes. Some systems also record ownership, permissions and physical storage details. Ordinary users usually work through database tools rather than editing the dictionary directly.
Because the DBMS maintains the dictionary centrally, every application can use the same table and attribute definitions. This reduces the risk of different programs interpreting the same data in different ways.
What Can the Data Dictionary Store?
The exact entries vary between DBMS products, but the following categories are typical and appropriate at this level.
| Metadata category | Example entry | How the DBMS can use it |
|---|---|---|
| Table name | Equipment |
Checks that a referenced table exists. |
| Attribute name | ReplacementCost |
Checks that a query uses a valid field. |
| Data type | REAL |
Rejects incompatible values and operations. |
| Length or size | EquipmentName: VARCHAR(60) |
Controls the maximum stored character length. |
| Null or presence rule | EquipmentName: NOT NULL |
Prevents required information from being omitted. |
| Default value | Available: TRUE |
Supplies a value when none is provided. |
| Key role | EquipmentID: PRIMARY KEY |
Enforces unique identification. |
| Relationship | Loan.EquipmentID β Equipment.EquipmentID |
Supports referential-integrity checks. |
| Validation or domain constraint | ReplacementCost β₯ 0 |
Rejects values outside the permitted domain. |
| Index definition | Index on Category |
Helps the query processor identify a possible access route. |
Example dictionary entries
| Table | Attribute | Type | Size | Required? | Key / rule |
|---|---|---|---|---|---|
| Equipment | EquipmentID | VARCHAR | 8 | Yes | Primary key |
| Equipment | EquipmentName | VARCHAR | 60 | Yes | β |
| Equipment | Category | VARCHAR | 24 | Yes | Indexed |
| Equipment | ReplacementCost | REAL | β | Yes | Must be at least 0 |
| Equipment | Available | BOOLEAN | β | Yes | Default TRUE |
How the Dictionary Is Kept Current
The dictionary must match the actual schema. Therefore, the DBMS updates dictionary entries whenever an authorised structural change is made.
- A developer uses a visual designer or a definition command to request a schema change.
- The DBMS checks whether the change is valid and whether it conflicts with existing objects.
- The DBMS changes the database structure.
- The corresponding metadata in the data dictionary are updated.
- Later tools read the revised definitions when validating queries or presenting the schema.
The Developer Interface
A developer interface gives a database developer access to tools for defining and modifying database structures. It may be graphical, text-based or a combination of both.
| Developer task | Possible interface action | Result |
|---|---|---|
| Create a table | Enter a table name and add fields in a visual table designer. | A new table structure is created. |
| Choose data types | Select INTEGER, REAL, DATE, BOOLEAN or a character type. | The DBMS knows how each value must be stored and checked. |
| Set sizes | Specify a maximum length for a variable-length character attribute. | Overlong values can be rejected. |
| Define keys | Mark one or more fields as a primary key or foreign key. | Uniqueness and references can be enforced. |
| Add constraints | Set required fields, defaults or permitted ranges. | Invalid structures or values can be prevented. |
| Define relationships | Link a foreign key to a referenced primary key. | The DBMS records and enforces the relationship. |
Worked design decision
A developer adds an attribute named SafetyCheckedOn to the
Equipment table:
After the change is accepted, the data dictionary contains a new entry describing
Equipment.SafetyCheckedOn.
The Query Processor
A query is a request to retrieve or change data. The query processor is the DBMS component that checks the request and carries out the necessary operations.
Query processor: the DBMS software that interprets, checks and executes a query.
Imagine that a makerspace coordinator requests:
Receive
Accept the query from a user interface or application.
Check
Check syntax, referenced objects, data types and permissions.
Plan
Choose a suitable way to access the required tuples.
Execute
Read or modify the relevant stored data.
Return
Provide a result or a clear error message.
During the checking stage, the processor can consult the data dictionary. It can confirm
that Equipment, EquipmentName,
ReplacementCost, Category and Available exist and
have suitable definitions.
How the Tools Work Together
The three syllabus concepts are closely connected:
Developer interface
A developer defines Equipment and its fields.
Data dictionary
The DBMS records the table, field types, keys and rules as metadata.
Query processor
A later query is checked against those definitions before execution.
| Situation | Tool or resource involved | What happens |
|---|---|---|
A developer creates EquipmentID as a primary key. |
Developer interface | The developer specifies the field and key rule. |
The DBMS records that EquipmentID is VARCHAR(8). |
Data dictionary | The metadata become available to DBMS tools. |
A query refers to an attribute called EquipName. |
Query processor + data dictionary | The invalid field name is detected before execution. |
A query filters ReplacementCost < 'cheap'. |
Query processor + data dictionary | The processor can detect an incompatible comparison with a REAL field. |
| A table is renamed by an authorised developer. | Developer interface + data dictionary | The DBMS applies the structural change and updates the metadata. |
Interactive: DBMS Tools Lab
Explore metadata, construct part of a table definition and run a query through a simplified query-processing pipeline.
Common Mistakes and Misconceptions
- Confusing metadata with the ordinary tuple values stored in a table.
- Describing the data dictionary as a dictionary of words or a list of user data.
- Claiming that the data dictionary contains only attribute names.
- Assuming developers should manually edit the DBMS's internal dictionary records.
- Describing the developer interface only as a form for entering data.
- Calling a query and the query processor the same thing.
- Jumping directly to SQL syntax instead of explaining the purpose of the DBMS tool.
- Forgetting that the query processor can use dictionary metadata to detect invalid references and types.
- Repeating security and backup detail from 8.2.1 instead of focusing on the required tools.
Practice
Original practice tasks
- Explain the difference between data and metadata using one database example.
- Define data dictionary and state four kinds of metadata it can contain.
- Explain how the DBMS could use dictionary entries for data type and foreign key when checking an attempted insertion.
-
A developer adds
MaximumLoanDays INTEGERto Category. Describe how the developer interface and data dictionary are involved. - State four practical tasks that can be completed through a developer interface.
- Describe the stages a query processor might follow after receiving a request.
-
A query refers to
Borrower.Fullname, but the dictionary recordsBorrower.FullName. Explain how the DBMS can respond. - Explain how the developer interface, data dictionary and query processor form one connected workflow.
Review
| Concept | Purpose | Typical example |
|---|---|---|
| Metadata | Describe stored data and database rules. | Attribute name, type, size or key role. |
| Data dictionary | Provides a central DBMS-managed repository of metadata. | Definition of Equipment.ReplacementCost. |
| Developer interface | Allows developers to define and modify database objects. | Create a table and choose its field types. |
| Query | Requests retrieval or modification of data. | Find all available sensors. |
| Query processor | Checks, plans and executes the query. | Reject an unknown field or return matching tuples. |