Dbms Module II
Dbms Module II
The principles of the relational model were first outlined by Dr. E.F. Codd in 1970 in a classic
paper called “A relational Model of Data for Large Shared Data Banks”. In this paper, Dr. Codd
proposed the relational model for the database.
The more popular models used at the time were hierarchical and network, or even
simple flat file data structures. Relational database management systems soon became very
popular especially for their ease of use and flexibility in structure. In addition, a number of
innovative vendors, such as Oracle, supplemented the RDBMS with a suite of powerful
application development and user products, providing a total solution.
Database
EMP DEPT
EMPNO ENAME DEPTNO DEPTNO DNAME LOC
7839 King 10 10 Accounting New York
7698 Blake 30 20 Research Dallas
7782 Clark 10 30 Sales Chicago
40 Operations Boston
7566 Jones 20
Example of a Relation
The data type describing the types of values that can appear in each columns is called a
domain.
- For example, schema of the STUDENT relation interprets that, a student entity has
Name,
Schema-based constraints
A relational database schema S is a set of relation schemas that belong to the same
database.
S is the name of the whole database schema.
State constraints
- define the constraints that a valid state of the database must satisfy.
Transition constraints
Operation
Delete the EMPLOYEE tuple with SSN= ‘333445555’.
Result: Not Acceptable. Violates Referential IC.
UPDATE may violate domain constraint and NOT NULL constraint on an attribute being
modified.
Any of the other constraints may also be violated, depending on the attribute being
updated:
Updating the primary key (PK):
Similar to a DELETE followed by an INSERT.
Need to specify similar options to DELETE.
Updating a foreign key (FK):
May violate referential integrity.
Updating an ordinary attribute (neither PK nor FK):
Can only violate domain constraints.
Operation
Result: Acceptable
Operation
Operation
Update the SSN of the EMPLOYEE tuple with SSN=‘999887777’ to
‘987654321’.
Relational Algebra
The two formal languages for the relational model: the relational algebra and the relational
calculus. Historically, the relational algebra and calculus were developed before the SQL
language. SQL is primarily based on concepts from relational calculus and has been extended to
incorporate some concepts from relational algebra as well. Most relational DBMSs use SQL as
their language.
o The basic set of operations for the formal relational model is the relational algebra.
o These operations enable a user to specify basic retrieval requests as relational algebra
expressions.
o A sequence of relational algebra operations forms a relational algebra expression, whose
result will also be a relation that represents the result of a database query.
o It provides a formal foundation for relational model operations.
o It is used as a basis for implementing and optimizing queries in the query processing and
optimization modules that are integral parts of relational database management systems
(RDBMSs)
o Some of its concepts are incorporated into the SQL standard query language for
RDBMSs.
o The relational calculus provides a higher-level declarative language for specifying
relational queries.
o In a relational calculus expression, there is no order of operations to specify how to
retrieve the query result—only what information the result should contain. This is the main
distinguishing feature between relational algebra and relational calculus.
o The SELECT operation is used to choose a subset of the tuples from a relation that
satisfies a selectioncondition.
o The SELECT operation acts as a filter that keeps only those tuples that satisfy a qualifying
In General
Example 2: To select the tuples for all employees who either work in department 4 and make
over $25,000 per year, or work in department 5 and make over $30,000, we can specify the
following SELECT operation:
o The PROJECT operation selects certain columns from the table and discards the other
columns.
o If only certain attributes of a relation are needed then the PROJECT operation is used
to project therelation over these attributes only.
o It can be visualized as a vertical partition of the relation into two relations: one has the
needed columns and contains the result of the operation, and the other contains the
discarded columns.
o The resulting relation has only the attributes specified in <attribute list> in the same
order as they appear in the list. Hence, its degree is equal to the number of attributes in
<attribute list>.
o The general form of the PROJECT operation is
Example: To list each employee’s first and last name and salary:
NOTE:
o The PROJECT operation removes any duplicate tuples, so the result of the PROJECT
operation is a set of distinct tuples, and hence a valid relation. This is known as duplicate
elimination.
o The number of tuples in a relation resulting from a PROJECT operation is always less
than or equal tothe number of tuples in R.
o Relational algebra expression can be written as an in-line expression, as follows:
RENAME operation can rename either the relation name or the attribute names, or both—as
a unary operator. Thegeneral is denoted by any of the following three forms:
Example:
o Two relations R(A1, A2, … , An) and S(B1, B2, … , Bn) are said to be union compatible
(or type compatible) if they have the same degree n and if dom(Ai) = dom(Bi) for 1 ≤ i ≤
n. This means that the two relations have the same number of attributes and each
corresponding pair of attributes has the same domain.
The three operations UNION, INTERSECTION, and SET DIFFERENCE are defined on
two union-compatiblerelations R and S as follows:
UNION: The result of union operation, denoted by R 𝖴 S, is a relation that includes all
tuples that are either in R orin S or in both R and S. Duplicate tuples are eliminated.
Note:
The JOIN operation is very important for any relational database with more than a one
relation because it allows us to process relationships among relations.
The JOIN operation, denoted by , on two relations R(A1, A2, … , An) and S(B1, B2, … ,
Bm) combines related tuples from two relations into single “longer” tuples that satisfy the join
Example: Suppose that we want to retrieve the name of the manager of each department.
To get the manager’s name, combine each department tuple with the employee tuple whose
Ssn value matches the Mgr_ssn value in the department tuple.
The EQUIJOIN
EQUIJOIN involves join conditions with equality comparisons only. Such a JOIN, where the
onlycomparison operator used is =, is called an EQUIJOIN.
Example: Retrieve the name and address of all employees who work for the ‘Research’
department.
Notice that in the result of an EQUIJOIN we always have one or more pairs of attributes that
have identical values in every tuple. For example, the values of the attributes Dnumber and
NATURAL JOIN
NATURAL JOIN—denoted by *, requires that the two join attributes (or each pair of join
attributes) have the same name in both relations. If this is not the case, a renaming operation is
applied first. NATURAL JOIN was created to get rid of the second (superfluous) attribute in
an EQUIJOIN condition.
The attribute Dnum is called the join attribute for the NATURAL JOIN operation, because it
is the only attribute with the same name in both relations. The resulting relation is only one
join attribute value is kept.
» If the chosen key was a composite, the set of simple attributes that form it will together be the
primary key of R.
Step 2
» For each weak entity type W in the ER schema with owner entity type E, create a relation R
that includes all simple attributes (or simple components of composites) of W.
» Include as foreign key attributes of R the primary key attribute of the relation that corresponds
to the owner entity type E.
» The primary key of R is the combination of the primary key of the owner and the partial key
of the weak entity type, if any.
Step 3
» For each binary 1:1 relationship type R in the ER schema, identify the relations S and T that
correspond to the entity types participating in R.
» Choose one of the relations (say S). Include as a foreign key in S the primary key of T.
» It is better to choose an entity type with total participation in R for the role of S.
Step 4
» For each binary 1:N relationship type R, identify the relation S that represents the entity type
participating at the N-side of the relationship
Step 5
» For each binary M:N relationship type R, create a new relation S to represent R.
» Include as foreign key attributes in S the primary keys of the participating entity types.
Step 6
» R will include an attribute corresponding to A, plus the primary key attribute K of the relation
that has A as an attribute.
Step 7
» For each n-ary relationship type R, where n>2, create a new relation S.
» Include as foreign key attributes in S the primary keys of the relations that represent the
participating entity types
SQL
The SQL language may be considered one of the major reasons for the commercial success of relational
databases. The name SQL is presently expanded as Structured Query Language. Originally, SQL was
called SEQUEL (Structured English QUEry Language) and was designed and implemented at IBM
Research as the interface for an experimental relational database system called SYSTEM R. SQL is now
the standard language for commercial relational DBMSs.
SQL is a comprehensive database language: It has statements for data definitions, queries, and updates.
Hence, it is both a DDL and a DML. It also has rules for embedding SQL statements into a general-
purpose programming language such as Java,COBOL,or C/C++.
SQL uses the terms table, row, and column for the formal relational model terms
relation,tuple,andattribute,respectively.We will use the corresponding terms interchangeably. The main
SQL command for data definition is the CREATE statement, which can be used to create schemas, tables
(relations), and domains (as well as other constructs such as views, assertions, and triggers).
The concept of an SQL schema was incorporated starting with SQL2 in order to group together tables and
other constructs that belong to the same database application. An SQL schema is identified by a schema
name, and includes an authorization identifier to indicate the user or account who owns the schema,as
well as descriptors for each element in the schema.Schema elements include
tables,constraints,views,domains,and other constructs (such as authorization grants) that describe the
schema.
A schema is created via the CREATE SCHEMA statement,which can include all the schema elements’
definitions. Alternatively, the schema can be assigned a name and authorization identifier, and the
elements can be defined later. For example, the following statement creates a schema called
COMPANY,owned by the user with authorization identifier ‘Jsmith’.Note that each statement in SQL
ends with a semicolon.
In general,not all users are authorized to create schemas and schema elements.The privilege to create
schemas, tables, and other constructs must be explicitly granted to the relevant user accounts by the
system administrator or DBA.
The CREATE TABLE command is used to specify a new relation by giving it a name and specifying its
attributes and initial constraints.The attributes are specified first, and each attribute is given a name, a data
type to specify its domain of values, and any attribute constraints, such as NOT NULL. The key, entity
integrity, and referential integrity constraints can be specified within the CREATE TABLE statement
rather than
we can explicitly (rather than implicitly) make the EMPLOYEEtable part of the COMPANY schema.
The relations declared through CREATE TABLE statements are called base tables (or base relations);
this means that the relation and its tuples are actually created and stored as a file by the DBMS.Base
relations are distinguished from virtual relations, created through the CREATE VIEWstatement which
may or may not correspond to an actual physical file.
Example:
CREATE TABLE EMPLOYEE ( Fname VARCHAR(15) NOT NULL, Minit CHAR, Lname
VARCHAR(15) NOT NULL, Ssn CHAR(9) NOT NULL, Bdate DATE, Address VARCHAR(30), Sex
CHAR, Salary DECIMAL(10,2), Super_ssn CHAR(9), Dno INT NOT NULL, PRIMARY KEY (Ssn),
FOREIGN KEY (Super_ssn) REFERENCES EMPLOYEE(Ssn), FOREIGN KEY (Dno) REFERENCES
DEPARTMENT(Dnumber)) ;
CREATE TABLE DEPARTMENT ( Dname VARCHAR(15) NOT NULL, Dnumber INT NOT NULL,
Mgr_ssn CHAR(9) NOT NULL, Mgr_start_date DATE, PRIMARY KEY (Dnumber), UNIQUE
(Dname), FOREIGN KEY (Mgr_ssn) REFERENCES EMPLOYEE(Ssn));
The basic data types available for attributes include numeric, character string, bit string,Boolean,date,and
time.
■Numeric data types include integer numbers of various sizes (INTEGER or INT, and SMALLINT) and
floating-point (real) numbers of various precision (FLOAT or REAL, and DOUBLE PRECISION).
Formatted numbers can be declared by using DECIMAL(i,j)—or DEC(i,j) or NUMERIC(i,j)—where i,
the precision, is the total number of decimal digits and j, the scale, is the number of digits after the
decimal point.
■Character-string data types are either fixed length—CHAR(n) or CHARACTER(n), where n is the
number of characters—or varying length— VARCHAR(n) or CHAR VARYING(n) or CHARACTER
VARYING(n),where nis the maximum number of characters.When specifying a literal string value,it is
placed between single quotation marks (apostrophes), and it is case sensitive (a distinction is made
between uppercase and lowercase).3 For fixedlength strings, a shorter string is padded with blank
characters to the right. For example, if the value ‘Smith’ is for an attribute of type CHAR(10), it is padded
with five blank characters to become ‘Smith ’ if needed.
for example,B‘10101’
■A Boolean data type has the traditional values of TRUE or FALSE. In SQL, because of the presence of
NULL values, a three-valued logic is used, so a third possible value for a Boolean data type is
UNKNOWN.
■ The DATE data type has ten positions, and its components are YEAR, MONTH, and DAY in the form
YYYY-MM-DD.
The TIME data type has at least eight positions,with the components HOUR,MINUTE,and SECOND in
the form HH:MM:SS.
■ A timestamp data type (TIMESTAMP) includes the DATE and TIME fields, plus a minimum of six
positions for decimal fractions of seconds and an optional WITH TIME ZONE qualifier.Literal values are
represented by singlequoted strings preceded by the keyword TIMESTAMP, with a blank space between
data and time;
■Another data type related to DATE, TIME, and TIMESTAMP is the INTERVAL data type. This
specifies an interval—a relative value that can be used to increment or decrement an absolute value of a
date, time, or timestamp. Intervals are qualified to be either YEAR/MONTH intervals or DAY/TIME
intervals.
It is possible to specify the data type of each attribute directly,as in Figure 4.1;alternatively, a domain can
be declared, and the domain name used with the attribute specification. This makes it easier to change the
data type for a domain that is used by numerous attributes in a schema,and improves schema
readability.For example, we can create a domain SSN_TYPE by the following statement:
We can use SSN_TYPE in place of CHAR(9) in the above create table for the attributes Ssn and
Super_ssn of EMPLOYEE, Mgr_ssn of DEPARTMENT, Essn of WORKS_ON, and Essn of
DEPENDENT.
Now will describe the basic constraints that can be specified in SQL as part of table creation. These
include key and referential integrity constraints, restrictions on attribute domains and NULLs,and
constraints on individual tuples within a relation.
Because SQL allows NULLs as attribute values,a constraint NOT NULLmay be specified if NULLis not
permitted for a particular attribute.This is always implicitly specified for the attributes that are part of the
It is also possible to define a default value for an attribute by appending the clause DEFAULT<value> to
an attribute definition.
Another type of constraint can restrict attribute or domain values using the CHECK clause following an
attribute or domain definition.
For example, suppose that department numbers are restricted to integer numbers between 1 and 20; then,
we can change the attribute declaration of Dnumber in the DEPARTMENT table to the following:
Dnumber INT NOT NULL CHECK (Dnumber> 0 AND Dnumber< 21);
Ex:
CREATE TABLE EMPLOYEE ( Dno INT NOT NULL DEFAULT 1, CONSTRAINT EMPPK
PRIMARY KEY (Ssn), CONSTRAINT EMPDEPTFK FOREIGN KEY(Dno) REFERENCES
DEPARTMENT(Dnumber) ON DELETE SET DEFAULT ON UPDATE CASCADE);
CREATE DOMAIN D_NUM AS INTEGER CHECK (D_NUM > 0 AND D_NUM <21 );
We can then use the created domain D_NUM as the attribute type for all attributes that refer to
department numbers In create table , such as Dnumber of DEPARTMENT, Dnum of PROJECT,Dno of
EMPLOYEE,and so on.
The PRIMARY KEY clause specifies one or more attributes that make up the primary key of a relation. If
a primary key has a single attribute, the clause can follow the attribute directly.
The UNIQUE clause specifies alternate (secondary) keys, as illustrated in the DEPARTMENT and
PROJECT table declarations.
Referential integrity is specified via the FOREIGN KEY clause. A referential integrity constraint can be
violated when tuples are inserted or deleted, or when a foreign key or primary key attribute value is
modified. The default action that SQL takes for an integrity violation is to reject the update operation that
will cause a violation, which is known as the RESTRICT option. However, the schema designer can
specify an alternative action to be taken by attaching a referential triggered action clause to any foreign
key constraint. The options include SET NULL, CASCADE, and SET DEFAULT. An option must be
qualified with either ON DELETE or ON UPDATE. We illustrate this with the examples shown in create
table Here, the database designer chooses ON DELETE SET NULL and ON UPDATE CASCADE for
the foreign key Super_ssn of EMPLOYEE. This means that if the tuple for a supervising employee is
A constraint may be given a constraint name,following the keyword CONSTRAINT. The names of all
constraints within a particular schema must be unique. A constraint name is used to identify a particular
constraint in case the constraint must be dropped later and replaced with another constraint. Giving names
to constraints is optional.
In addition to key and referential integrity constraints, which are specified by special keywords, other
table constraints can be specified through additional CHECK clauses at the end of a CREATE TABLE
statement. These can be called tuple-based constraints because they apply to each tuple individually and
are checked whenever a tuple is inserted or modified.Forexample,suppose that the DEPARTMENTtable
in Figure 4.1 had an additional attribute Dept_create_date, which stores the date when the department was
created. Then we could add the following CHECK clause at the end of the CREATE TABLE statement
for the DEPARTMENT table to make sure that a manager’s start date is later than the department creation
date.
SQL allows a table (relation) to have two or more tuples that are identical in all their attribute
values.Hence,in general, an SQL table is not a set of tuples, because a set does not allow two identical
members; rather,it is a multiset (sometimes called a bag) of tuples.
The basic form of the SELECT statement, sometimes called a mapping or a select-from-where block,
isformed of the three clauses SELECT, FROM, and WHERE and has the following form:
Ex:Retrieve the birth date and address of the employee(s) whose name is ‘John B.Smith’.
Query 1.a.
Retrieve the name and address of all employees who work for the ‘Research’department.
In the WHERE clause of query, the condition Dname = ‘Research’is a selection condition that chooses
the particular tuple of interest in the DEPARTMENT table,becauseDname is an attribute of
DEPARTMENT. The condition Dnumber = Dno is called a join condition, because it combines two
tuples: one from DEPARTMENT and one from EMPLOYEE, whenever the value of Dnumber in
DEPARTMENT is equal to the value of Dno in EMPLOYEE.
A query that involves only selection and join conditions plus projection attributes is known as a select-
project-join query. The next example is a select-project-join query with two join conditions.
Query 2.
For every project located in ‘Stafford’, list the project number, the controlling department number,
and the department manager’s last name, address,and birth date.
SELECT Pnumber, Dnum, Lname, Address, Bdate FROM PROJECT, DEPARTMENT, EMPLOYEE
WHERE Dnum=Dnumber AND Mgr_ssn=Ssn AND Plocation=‘Stafford’;
In SQL,the same name can be used for two (or more) attributes as long as the attributes are in different
relations.If this is the case,and a multitable query refers to two or more attributes with the same name, we
must qualify the attribute name with the relation name to prevent ambiguity. This is done by prefixing
the relation name to the attribute name and separating the two by a period.
We can also create an alias for each table name to avoid repeated typing of long table names.
For each employee, retrieve the employee’s first and last name and the first and last name of his or
her immediate supervisor.
In this case, we are required to declare alternative relation names E and S, called aliases or tuple
variables, for the EMPLOYEE relation. An alias can follow the keyword AS, as shown in Query,or it can
directly follow the relation name—for example, by writing EMPLOYEE E, EMPLOYEE S in the FROM
clause of Query.
It is also possible to rename the relation attributes within the query in SQL by giving them aliases. For
example,if we write EMPLOYEE AS E(Fn, Mi, Ln, Ssn, Bd, Addr, Sex, Sal, Sssn, Dno) in the
FROMclause,Fn becomes an alias for Fname,Mi for Minit,Ln for Lname,and so on.
In Query,we can think of E and S as two different copies of the EMPLOYEErelation;the first, E,
represents employees in the role of supervisees or subordinates; the second, S, represents employees in
the role of supervisors.
A missing WHERE clause indicates no condition on tuple selection; hence, all tuples of the relation
specified in the FROM clause qualify and are selected for the query result.If more than one relation is
Select all EMPLOYEE Ssns (Q9) and all combinations of EMPLOYEE Ssn and DEPARTMENT Dname
(Q10) in the database.
It is extremely important to specify every selection and join condition in the WHERE clause; if any such
condition is overlooked, incorrect and very large relations may result.
SQL usually treats a table not as a set but rather as a multiset; duplicate tuples can appear more than once
in a table,and in the result of a query. SQL does not automatically eliminate duplicate tuples in the results
of queries.
If we do want to eliminate duplicate tuples from the result of an SQL query, we use the keyword
DISTINCT in the SELECT clause, meaning that only distinct tuples should remain in the result.
Query 11. Retrieve the salary of every employee (Q11) and all distinct salary values
(Q11A).
In general, a query with SELECT DISTINCT eliminates duplicates, whereas a query with SELECT ALL
does not.
SQL has directly incorporated some of the set operations from mathematical set theory,which are also
part of relational algebra (see Chapter 6).There are set union (UNION), set difference (EXCEPT) and set
intersection (INTERSECT) operations. The relations resulting from these set operations are sets of
tuples; that is, duplicate tuples are eliminated from the result. These set operations apply only to union-
compatible relations, so we must make sure that the two relations on which we apply the operation have
the same attributes and that the attributes appear in the same order in both relations.The next example
illustrates the use of UNION.
Query 4. Make a list of all project numbers for projects that involve an employee whose last name is
‘Smith’, either as a worker or as a manager of the department that controls the project.
UNION
In this section we discuss several more features of SQL.The first feature allows comparison conditions on
only parts of a character string, using the LIKE comparison operator.This can be used for string pattern
matching. Partial strings are specified using two reserved characters: % replaces an arbitrary number of
zero or more characters,and the underscore (_) replaces a single character.Forexample,consider the
following query.
Query 12A.Find all employees who were born during the 1950s.
Another feature allows the use of arithmetic in queries. The standard arithmetic operators for addition (+),
subtraction (–), multiplication (*), and division (/) can be applied to numeric values or attributes with
numeric domains.
Query 13.Show the resulting salaries if every employee working on the ‘ProductX’project is given a
10 percent raise.
Another comparison operator, which can be used for convenience,isBETWEEN, which is illustrated in
Query 14.
Query 14.Retrieve all employees in department 5 whose salary is between $30,000 and $40,000.
SELECT * FROM EMPLOYEE WHERE (Salary BETWEEN 30000 AND 40000) AND Dno = 5;
SQL allows the user to order the tuples in the result of a query by the values of one or more of the
attributes that appear in the query result, by using the ORDER BY clause.
The default order is in ascending order of values.We can specify the keyword DESC if we want to see the
result in a descending order of values.The keyword ASCcan be used to specify ascending order explicitly.
A simple retrieval query in SQL can consist of up to four clauses, but only the first two—SELECT and
FROM—are mandatory. The clauses are specified in the following order,with the clauses between square
brackets [ ... ] being optional:
SELECT <attribute list> FROM <table list>[ WHERE<condition> ] [ ORDER BY <attribute list> ];
The SELECTclause lists the attributes to be retrieved,and the FROMclause specifies all relations (tables)
needed in the simple query. The WHERE clause identifies the conditions for selecting the tuples from
these relations, including join conditions if needed.ORDERBYspecifiesan order for displaying the results
of a query.
In its simplest form,INSERTis used to add a single tuple to a relation.We must specify the relation name
and a list of values for the tuple.The values should be listed in the same order in which the corresponding
attributes were specified in the CREATE TABLE command.
A second form of the INSERT statement allows the user to specify explicit attribute names that
correspond to the values provided in the INSERTcommand.This is useful if a relation has many attributes
but only a few of those attributes are assigned values in the new tuple.
Attributes not specified in the above query are set to their DEFAULT or to NULL, and the values are
listed in the same order as the attributes are listed in the INSERTcommand itself.
A variation of the INSERT command inserts multiple tuples into a relation in conjunction with creating
the relation and loading it with the result of a query.
The DELETE command removes tuples from a relation.It includes a WHERE clause, similar to that used
in an SQL query, to select the tuples to be deleted. Tuples are explicitly deleted from only one table at a
time. However, the deletion may propagate to tuples in other relations if referential triggered actions are
specified in the referential integrity constraints of the DDL. Depending on the number of tuples selected
by the condition in the WHERE clause, zero, one, or several tuples can be deleted by a single DELETE
command. A missing WHERE clause specifies that all tuples in the relation are to be deleted; however,
the table remains in the database as an empty table.
The UPDATE command is used to modify attribute values of one or more selected tuples. As in the
DELETE command, a WHERE clause in the UPDATE command selects the tuples to be modified from a
single relation. However, updating a primary key value may propagate to the foreign key values of tuples
in other relations if such a referential triggered action is specified in the referential integrity constraints of
the DDL. An additional SET clause in the UPDATE command specifies the attributes to be modified and
their new values.
For example, to change the location and controlling department number of project number 10 to
‘Bellaire’and 5,respectively,we use the below query
Several tuples can be modified with a single UPDATE command. An example is to give all employees in
the ‘Research’department a 10 percent raise in salary.
SQL has various techniques for specifying complex retrieval queries, including nested queries, aggregate
functions, grouping, joined tables,outerjoins,and recursive queries; SQL views,triggers,and assertions;
and commands for schema modification.
■ SQL has various techniques for writing programs in various programming languages that include SQL
statements to access one or more databases. These include embedded (and dynamic) SQL, SQL/CLI (Call
Level Interface) and its predecessor ODBC (Open Data Base Connectivity), and SQL/PSM (Persistent
Stored Modules).
■ Each commercial RDBMS will have,in addition to the SQL commands,a set of commands for
specifying physical database design parameters, file structures for relations, and access paths such as
indexes.
SQL has transaction control commands. These are used to specify units of database processing for
concurrency control and recovery purposes.
. ■ SQL has language constructs for specifying the granting and revoking of privileges to users.Privileges
typically correspond to the right to use certain SQL commands to access certain relations. Each relation is
In addition, the DBA staff can grant the privileges to create schemas, tables, or views to certain users.
These SQL commands—called GRANT and REVOKE—
■ SQL has language constructs for creating triggers. These are generally referred to as active database
techniques, since they specify actions that are automatically triggered by events such as database updates.
■ SQL has incorporated many features from object-oriented models to have more powerful
capabilities,leading to enhanced relational systems known as object-relational.
■ SQL and relational databases can interact with new technologies such as XML .