A database system provides a data-definition language to specify the database
schema and a data-manipulation language to express database queries and updates.
In practice, the data-definition and data-manipulation languages are not
two separate languages; instead they simply form parts of a single database language,
such as the widely used SQL language:
1. Data-Manipulation Language
A data-manipulation language (DML) is a language that enables users to access
or manipulate data as organized by the appropriate data model. The types of
• Retrieval of information stored in the database
• Insertion of new information into the database
• Deletion of information from the database
• Modification of information stored in the database
There are basically two types:
• Procedural DMLs require a user to specify what data are needed and how to
get those data.
• Declarative DMLs (also referred to as nonprocedural DMLs) require a user to
specify what data are needed without specifying how to get those data.
Declarative DMLs are usually easier to learn and use than are procedural
DMLs. However, since a user does not have to specify how to get the data, the
database system has to figure out an efficient means of accessing data.
A query is a statement requesting the retrieval of information. The portion of
a DML that involves information retrieval is called a query language. Although
technically incorrect, it is common practice to use the terms query language and
data-manipulation language synonymously.
There are a number of database query languages in use, either commercially
or experimentally. The levels of abstraction apply not only to defining or structuring
data, but also to manipulating data. At the physical level, we must define algorithms
that allow efficient acccess to data. at higher levels of abstraction, we emphasize ease of
use. the goal is to allow humans to interact efficiently with the system. The query
processor component of the database system translates DML queries
into sequences of actions at the physical level of the database system.
2. Data-Definition Language
We specify a database schema by a set of definitions expressed by a special
language called a data-definition language (DDL). The DDL is also used to specify
additional properties of the data.
We specify the storage structure and access methods used by the database
system by a set of statements in a special type of DDL called a data storage and
definition language. These statements define the implementation details of the
database schemas, which are usually hidden from the users.
The data values stored in the database must satisfy certain consistency constraints.
For example, suppose the university requires that the account balance
of a department must never be negative. The DDL provides facilities to specify
such constraints. The database system checks these constraints every time the
database is updated. In general, a constraint can be an arbitrary predicate pertaining
to the database.However, arbitrary predicates may be costly to test. Thus,
database systems implement integrity constraints that can be testedwith minimal
• Domain Constraints: A domain of possible values must be associated with
every attribute (for example, integer types, character types, date/time types).
Declaring an attribute to be of a particular domain acts as a constraint on the
values that it can take. Domain constraints are the most elementary form of
integrity constraint. They are tested easily by the system whenever a new
data item is entered into the database.
• Referential Integrity: There are cases where we wish to ensure that a value
that appears in one relation for a given set of attributes also appears in a certain
set of attributes in another relation (referential integrity). For example,
the department listed for each course must be one that actually exists. More
precisely, the dept name value in a course record must appear in the dept name
attribute of some record of the department relation. Database modifications
can cause violations of referential integrity.When a referential-integrity constraint
is violated, the normal procedure is to reject the action that caused the
• Assertions: An assertion is any condition that the database must always
satisfy. Domain constraints and referential-integrity constraints are special
forms of assertions. However, there are many constraints that we cannot
express by using only these special forms. For example, “Every department
must have at least five courses offered every semester” must be expressed as
an assertion. When an assertion is created, the system tests it for validity. If
the assertion is valid, then any future modification to the database is allowed
only if it does not cause that assertion to be violated.
• Authorization: We may want to differentiate among the users as far as the
type of access they are permitted on various data values in the database. These
differentiations are expressed in terms of authorization, the most common
being: read authorization, which allows reading, but not modification, of
data; insert authorization, which allows insertion of new data, but not modification
of existing data; update authorization, which allows modification,
but not deletion, of data; and delete authorization, which allows deletion of
data. We may assign the user all, none, or a combination of these types of
The DDL, just like any other programming language, gets as input some
instructions (statements) and generates some output. The output of the DDL is
placed in the data dictionary,which contains metadata—that is, data about data.
The data dictionary is considered to be a special type of table that can only be
accessed and updated by the database system itself (not a regular user). The
database system consults the data dictionary before reading or modifying actual