What is Data Definition?

From InterBase
Jump to: navigation, search

Go Up to Using the Data Definition Guide


An InterBase database is created and populated using SQL statements, which can be divided into two major categories: data definition language (DDL) statements and data manipulation language (DML) statements.

The underlying structures of the database – its tables, views, and indexes – are created using DDL statements. Collectively, the objects defined with DDL statements are known as metadata. Data definition is the process of creating, modifying, and deleting metadata. Conversely, DML statements are used to populate the database with data, and to manipulate existing data stored in the structures previously defined with DDL statements. The focus of this book is how to use DDL statements. For more information on using DML statements, see the Language Reference Guide.

DDL statements that create metadata begin with the keyword CREATE, statements that modify metadata begin with the keyword ALTER, and statements that delete metadata begin with the keyword DROP. Some of the basic data definition tasks include:

  • Creating a database (CREATE DATABASE).
  • Creating tables (CREATE TABLE).
  • Altering tables (ALTER TABLE).
  • Dropping tables (DROP TABLE).

InterBase stores database metadata and other information about it in system tables, which are automatically created when you create a database. All system table names begin with “RDB$”. Examples of system tables include RDB$RELATIONS, which has information about each table in the database, and RDB$FIELDS, which has information on the domains in the database.

Writing to these system tables without sufficient knowledge can corrupt a database. Therefore, public users can only select from them. The database owner and SYSDBA user have full read and write privileges and can assign these privileges to others if they wish. For more information about the system tables, see the Language Reference Guide.

Important: If you have permission, you can directly modify columns of a system table, but unless you understand all of the interrelationships between the system tables, modifying them directly can adversely affect other system tables and corrupt your database.

Advance To: