Database Reference
In-Depth Information
in a certain relation. The next clause, “retrieve” serves to indicate the values of
selected attributes from the declared relation that must be found in the result. The
“where” clause sets the conditions and constraints for the data retrieval.
Examine the following Quel queries and note the basic constructs.
Query: List the names of the customers in Japan.
range of r is customer
retrieve unique r.customer-name where r.customer-country
'Japan'
Query: List the names and countries of customers who bought product 2241.
range of r is customer
range of s is sale
retrieve unique (r.customer-name, r.customer-country)
where s.product-id = ' 2241 ' and r.customer-id = s.customer-id
=
Quel has provisions to perform the following functions, all functions being
structured in a similar basic format:
Perform arithmetic aggregate functions such as count, sum, average, maximum,
minimum, and so on
Execute simple and complex queries
Data maintenance—deletion, insertion, and update
Do set operations
Datalog As you know, a nonprocedural language simply states the desired
solution without writing out a set of procedural statements to arrive at the result.
You have seen that relational calculus is a generic nonprocedural language. In the
same way, Datalog is a nonprocedural query language developed based on Prologic,
a logic-programming language. In a Datalog query, the user simply describes the
desired information without writing a detailed procedure on how to obtain that
information.
A Datalog program is made up of a set of rules. A Datalog view defines a view
of a given relation. You may consider a view as a subset of the given relation. Figure
13-7 illustrates the definition of a Datalog view and the description of a Datalog
query. Notice the nonprocedural nature of the language.
SQL: THE RELATIONAL STANDARD
Designed and developed at IBM Research in the early 1970s as the language
interface for an experimental relational database, SQL has become the accepted
relational standard. Consider the DBMS of any relational database vendor. You
will find that every vendor has adopted the standard version of SQL and added
some embellishments. It is even doubtful that the relational data model would
have gained such popularity and acceptance without SQL.
SQL makes the transition from one relational DBMS to another easy. Businesses
that move into relational databases from hierarchical or network database systems
Search WWH ::




Custom Search