You can use SQL commands to create database objects, run
queries, and manage the database. This section describes how to use
the commands to do common tasks.
Manage tables
You can create, access, and manipulate tables by using
SQL commands.
Join tables
Queries can access multiple tables at once, or access the
same table in such a way that multiple rows of the table are being
processed at the same time. A query that accesses multiple rows of
the same or different tables at one time is called a join query.
Combine tables with UNION, INTERSECT, and EXCEPT
With the standard set operations UNION, INTERSECT, and
EXCEPT/MINUS, you can combine the results from two or more SELECT
statements to construct more complex queries.
Manage views
You can use views to focus, simplify, and customize the
perception of the database for each user. You can use views as a security
mechanism by allowing users to access data through the view, without
granting the users permission to access the base tables directly.
Materialized views
A materialized view (sometimes called a sorted, projected,
and materialized view or SPM view) is a view whose columns
have been sorted, projected, and materialized (that is, stored physically
in a unique table).
Subqueries
A subquery is a select expression that is enclosed in parentheses
as a nested query block in a query statement.
Aggregate functions
An aggregate function computes a single result from multiple
input rows.
Run scripts
You can use scripts to bundle all your queries into a single
file, which you can then run automatically and repeatedly. You can
create a script by using any standard editor and typing regular SQL
commands.
Feedback | Copyright IBM Corporation 2014 | Last updated: 2014-02-28