Previous Topic

Next Topic

From

The FROM clause specifies the source tables and views from which data is to be read. The specified tables and views must exist at the time the query is issued. The from_source parameter can be:

A maximum of 126 tables can be specified in a query, including the tables in the from list, tables in subselects, and tables and views resulting from the expansion of the definitions of any views included in the query.

Previous Topic

Next Topic

Where

The WHERE clause specifies criteria that restrict the contents of the results table. Tests can be performed for simple relationships or, using subselects, for relationships between a column and a set of columns.

Previous Topic

Next Topic

Simple Where Clauses

Using a simple WHERE clause, the contents of the results table can be restricted, as follows:

Comparisons:

select ename from employees
       where manager = 'Jones';
select ename from employees
       where salary > 50000;

Ranges:

select ordnum from orders
       where odate between date('jan-01-1993') and
       date('today');

Set membership:

select * from orders
       where partno in ('123-45', '678-90');

Pattern matching:

select * from employees
       where ename like 'A%';

Nulls:

select ename from employees
       where edept is null;

Combined restrictions using logical operators:

select ename from employees
       where edept is null and
       hiredate = date('today');

Note: Aggregate functions cannot appear anywhere in a where clause.


© 2007 Ingres Corporation. All rights reserved.