[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
INTO clause.
PLAIN
Prevents column headings from appearing in query output. Ignored within
INTO clause.
NOWAIT
Scrolls query results off the screen when the screen becomes full
instead of asking you to press a key to continue to the next screen full
of results. Ignored with INTO clause.
[WHERE <joincondition>
[AND <joincondition> ...]
[AND | OR <filtercondition>
[AND | OR <filtercondition>...]]]
Includes only certain records in the query results. <joincondition>
specifies fields that link the databases in the FROM clause. With more
than one database in a query, you should specify a join condition for
every database after the first.
. WARNING .
If you include two databases in a query and don't specify a join
condition, every record in the first database will be joined with every
record in the second database as long as the filter conditions are met.
This can produce sizable query results.
Be careful when joining databases with empty fields - FoxPro matches
empty fields. To avoid this, use EMPTY().
Multiple join conditions must be connected with the AND operator.
<joinconditions> can contain field functions and have the form:
<field1> <comparison> <field2>
where <field1> is a field from one database, <field2> is a field from
another database and <comparison> is one of the following:
<comparison>
------------
=
< >, !=, #
= =
>
> =
<
< =
When you use the = comparison with strings, it acts differently
depending on the setting of the SET ANSI command.
<filtercondition> specifies criteria that records must meet to be
included in the query results. You can connect filter conditions with
the AND or the OR operator. You can also use NOT to reverse the
outcome of a logical expression or use EMPTY() to check for an empty
field. <filtercondition> can take one of these forms:
Form: <field1> <comparison> <field2>
Example: customer.cust_id = payments.cust_id
Form: <field> <comparison> <expression>
Example: payments.amount >= 1000
Form: <field> <comparison> ALL (<subquery>)
Example: taxrate < ALL ;
(SELECT taxrate FROM customer WHERE state = 'MI')
With ALL, the <field> must meet the comparison condition for all
values generated by the subquery before its record is included in the
query results.
Form: <field> <comparison> ANY | SOME (<subquery>)
Example: taxrate < ANY ;
(SELECT taxrate FROM customer WHERE state = 'MI')
With ANY or SOME, the <field> must meet the comparison condition for
at least one of the values generated by the subquery.
Form: <field> [NOT] BETWEEN <start_range> AND <end_range>
Example: customer.taxrate BETWEEN 5.50 AND 6.00
Checks to see if <field> is within a range of values.
Form: [NOT] EXISTS (<subquery>)
Example: EXISTS ;
(SELECT * FROM invoice WHERE customer.zip = invoice.zip)
Checks to see if at least one row meets the criteria in the subquery.
With EXISTS, the filter condition evaluates to true unless the subquery
evaluates to the empty set.
Form: <field> [NOT] IN <value_set>
Example: customer.zip NOT IN ('43411','43506','43667')
With IN, <field> must be part of a given set of values before its
record is included in the query results.
Form: <field> [NOT] IN (<subquery>)
Example: customer.cust_id IN ;
(SELECT tranfile.cust_id FROM tranfile WHERE tranfile.item='FoxPro')
With this form, <field> must be part of the set of values returned by
the subquery before its record is included in the query results.
Form: <field> [NOT] LIKE <expC>
Example: customer.state NOT LIKE 'OH'
This filter condition searches for each <field> that matches the
specified <expC>. You can use the wildcard characters % (percent) and _
(underscore) as part of <expC>. The _ represents a single unknown
character in the string and the % represents a sequence of unknown
characters in the string.
A subquery is a SELECT within a SELECT and must be enclosed in
parentheses. You can have multiple subqueries at the same level (not
nested) in the WHERE clause. Subqueries can contain multiple join
conditions.
The following functions can be used in the join condition of the WHERE
clause: UPPER(), VAL(), DTOC(), PADR(), PADL() and PADC().
[GROUP BY <groupcolumn>
[, <groupcolumn> ...]]
Groups rows in the query based on values in column(s). <groupcolumn>
can be a database field, a database field that includes a SQL field
function or a numeric expression indicating the location of the column
in the result table (the leftmost column is number 1).
HAVING <filtercondition>
Tells FoxPro to include groups in the query results as long as they
meet the <filtercondition>. <filtercondition> cannot contain a
subquery.
HAVING <filtercondition> should be used with GROUP BY to specify the
criteria that groups must meet to be included in the query results.
HAVING can include as many filter conditions as desired, connected with
the AND or the OR operator. You can also use NOT to reverse the outcome
of a logical expression.
HAVING without a GROUP BY acts like a WHERE clause. You can use local
aliases and field functions in the HAVING clause.
[UNION [ALL] <SELECT command>]
Combines final results of one SELECT command with final results of
another <SELECT command>. By default, UNION checks through the combined
results and eliminates duplicate rows. Use ALL to prevent UNION from
eliminating duplicate rows from the combined results.
You can use parentheses to combine multiple UNION clauses.
UNION rules:
. You can't use UNION to combine subqueries.
. Both SELECT commands must output the same number of columns.
. Each column in the query results of one SELECT command must have the
same data type as the corresponding column in the other <SELECT
command>.
. Only the final <SELECT command> can have an ORDER BY clause and
ORDER BY must refer to output columns by number. If ORDER BY is
included, it affects the entire results.
[ORDER BY <order_item>
[ASC | DESC][, <order_item>
[ASC | DESC]...]]
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson