Database Languages




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
access are:


• 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
overhead:


• 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
violation.


• 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
authorization.


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
data.



Frequently Asked Questions

+
Ans: This chapter discusses techniques for securing databases against a variety of threats. It also presents schemes of providing access privileges to authorized users. view more..
+
Ans: In this section we discuss the concepts of concurrent execution of transactions and recovery from transaction failures view more..
+
Ans: A database system is a collection of interrelated data and a set of programs that allow users to access and modify these data. A major purpose of a database system is to provide users with an abstract view of the data. That is, the system hides certain details of how the data are stored and maintained. view more..
+
Ans: A database system provides a data-definition language to specify the database schema and a data-manipulation language to express database queries and updates. view more..
+
Ans: Database design mainly involves the design of the database schema. The design of a complete database application environment that meets the needs of the enterprise being modelled requires attention to a broader set of issues. view more..
+
Ans: A relational database is based on the relational model and uses a collection of tables to represent both data and the relationships among those data. view more..
+
Ans: A relational database is based on the relational model and uses a collection of tables to represent both data and the relationships among those data. view more..
+
Ans: A relational database is based on the relational model and uses a collection of tables to represent both data and the relationships among those data. view more..
+
Ans: A database system is partitioned into modules that deal with each of the responsibilities of the overall system. The functional components of a database system can be broadly divided into the storage manager and the query processor components. view more..
+
Ans: A transaction is a collection of operations that performs a single logical function in a database application. view more..
+
Ans: The architecture of a database system is greatly influenced by the underlying computer system on which the database system runs. Database systems can be centralized, or client-server, where one server machine executes work on behalf of multiple client machines. view more..
+
Ans: The term data mining refers loosely to the process of semi-automatically analysing large databases to find useful patterns. view more..
+
Ans: Researchers have developed several data-models to deal with these application domains, including object-based data models and semi-structured data models. view more..
+
Ans: A primary goal of a database system is to retrieve information from and store new information into the database. People who work with a database can be categorized as database users or database administrators. view more..
+
Ans: Information processing drives the growth of computers, as it has from the earliest days of commercial computers. In fact, automation of data processing tasks predates computers. view more..
+
Ans: A relational database consists of a collection of tables, each of which is assigned a unique name. view more..
+
Ans: The database schema is the logical design of the database. view more..
+
Ans: A super-key is a set of one or more attributes that, taken collectively, allow us to identify uniquely a tuple in the relation. view more..




Rating - 3/5
458 views

Advertisements