Article Preview
Buy Now
COLUMN
SQL Subqueries
Queries within queries
Issue: 20.3 (May/June 2022)
Author: Vince Du Beau
Author Bio: Vince is an experienced Filemaker developer. He is exploring XOJO as an alternative to Filemaker.
Article Description: No description available.
Article Length (in bytes): 5,504
Starting Page Number: 84
Article Number: 20310
Related Link(s): None
Excerpt of article text...
A subquery is a
SELECT
within another SQL statement. They are also know as aninner query ornested query . They can be used withSELECTs
,INSERTs
,UPDATEs
, andDELETEs
. Here I have only used it within anotherSELECT
statement.The following rules for subqueries are from
https://www.tutorialspoint.com/sql/sql-sub-queries.htm
: Subqueries must be enclosed within parentheses.
- A subquery can have only one column in the
SELECT
clause, unless multiple columns are in the main query for the subquery to compare its selected columns.
- An
ORDER BY
command cannot be used in a subquery, although the main query can use anORDER BY
. TheGROUP BY
command can be used to perform the same function as theORDER BY
in a subquery.
- Subqueries that return more than one row can only be used with multiple value operators such as the IN operator.
- The
SELECT
list cannot include any references to values that evaluate to aBLOB
,ARRAY
,CLOB
, orNCLOB
.
...End of Excerpt. Please purchase the magazine to read the full article.