Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
0d01fd4e
Commit
0d01fd4e
authored
Mar 19, 1999
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add EXCEPT/INTERSECT doc changes.
parent
58cc2b6e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
20 deletions
+93
-20
doc/src/sgml/ref/select.sgml
doc/src/sgml/ref/select.sgml
+81
-8
doc/src/sgml/sql.sgml
doc/src/sgml/sql.sgml
+1
-1
src/bin/psql/psqlHelp.h
src/bin/psql/psqlHelp.h
+9
-9
src/man/select.l
src/man/select.l
+2
-2
No files found.
doc/src/sgml/ref/select.sgml
View file @
0d01fd4e
...
@@ -24,7 +24,7 @@ SELECT [ALL|DISTINCT [ON <replaceable class="PARAMETER">column</replaceable>] ]
...
@@ -24,7 +24,7 @@ SELECT [ALL|DISTINCT [ON <replaceable class="PARAMETER">column</replaceable>] ]
[ WHERE <replaceable class="PARAMETER">condition</replaceable> ]
[ WHERE <replaceable class="PARAMETER">condition</replaceable> ]
[ GROUP BY <replaceable class="PARAMETER">column</replaceable> [, ...] ]
[ GROUP BY <replaceable class="PARAMETER">column</replaceable> [, ...] ]
[ HAVING <replaceable class="PARAMETER">condition</replaceable> [, ...] ]
[ HAVING <replaceable class="PARAMETER">condition</replaceable> [, ...] ]
[
UNION [ALL]
<replaceable class="PARAMETER">select</replaceable> ]
[
{ UNION [ALL] | INTERSECT | EXCEPT }
<replaceable class="PARAMETER">select</replaceable> ]
[ ORDER BY <replaceable class="PARAMETER">column</replaceable> [ ASC | DESC ] [, ...] ]
[ ORDER BY <replaceable class="PARAMETER">column</replaceable> [ ASC | DESC ] [, ...] ]
</synopsis>
</synopsis>
...
@@ -230,8 +230,16 @@ including duplicates.
...
@@ -230,8 +230,16 @@ including duplicates.
DESCending mode operator. (See ORDER BY clause)</para>
DESCending mode operator. (See ORDER BY clause)</para>
<para>
<para>
The UNION clause specifies a table derived from a Cartesian
The UNION clause allows the result to be the collection of rows
product union join. (See UNION clause).</para>
returned by the queries involved. (See UNION clause).</para>
<para>
The INTERSECT give you the rows that are common to both queries.
(See INTERSECT clause).</para>
<para>
The EXCEPT give you the rows in the upper query not in the lower query.
(See EXCEPT clause).</para>
<para>
<para>
You must have SELECT privilege to a table to read its values
You must have SELECT privilege to a table to read its values
...
@@ -370,7 +378,8 @@ SELECT name FROM distributors ORDER BY code;
...
@@ -370,7 +378,8 @@ SELECT name FROM distributors ORDER BY code;
specifies any select expression without an ORDER BY clause.</para>
specifies any select expression without an ORDER BY clause.</para>
<para>
<para>
The UNION operator specifies a table derived from a Cartesian product.
The UNION clause allows the result to be the collection of rows
returned by the queries involved. (See UNION clause).
The two tables that represent the direct operands of the UNION must
The two tables that represent the direct operands of the UNION must
have the same number of columns, and corresponding columns must be
have the same number of columns, and corresponding columns must be
of compatible data types.</para>
of compatible data types.</para>
...
@@ -381,11 +390,75 @@ SELECT name FROM distributors ORDER BY code;
...
@@ -381,11 +390,75 @@ SELECT name FROM distributors ORDER BY code;
<para>
<para>
Multiple UNION operators in the same SELECT statement are
Multiple UNION operators in the same SELECT statement are
evaluated left to right.
evaluated left to right.
Note that the ALL keyword is not global in nature, being
Note that the ALL keyword is not global in nature, being
applied only for the current pair of table results.</para>
applied only for the current pair of table results.</para>
</refsect2>
<refsect2 id="R2-SQL-INTERSECT-2">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
INTERSECT Clause
</title>
<para>
<synopsis>
<replaceable class="PARAMETER">table_query</replaceable> INTERSECT <replaceable class="PARAMETER">table_query</replaceable>
[ ORDER BY <replaceable class="PARAMETER">column</replaceable> [ ASC | DESC ] [, ...] ]
</synopsis>
where
<replaceable class="PARAMETER">table_query</replaceable>
specifies any select expression without an ORDER BY clause.</para>
<para>
The INTERSECT clause allows the result to be all rows that are
common to the involved queries. (See INTERSECT clause).
The two tables that represent the direct operands of the INTERSECT must
have the same number of columns, and corresponding columns must be
of compatible data types.</para>
<para>
Multiple INTERSECT operators in the same SELECT statement are
evaluated left to right.
</para>
</refsect2>
<refsect2 id="R2-SQL-EXCEPT-2">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
EXCEPT Clause
</title>
<para>
<synopsis>
<replaceable class="PARAMETER">table_query</replaceable> EXCEPT <replaceable class="PARAMETER">table_query</replaceable>
[ ORDER BY <replaceable class="PARAMETER">column</replaceable> [ ASC | DESC ] [, ...] ]
</synopsis>
where
<replaceable class="PARAMETER">table_query</replaceable>
specifies any select expression without an ORDER BY clause.</para>
<para>
The EXCEPT clause allows the result to be rows from the upper query
that are not in the lower query. (See EXCEPT clause).
The two tables that represent the direct operands of the EXCEPT must
have the same number of columns, and corresponding columns must be
of compatible data types.</para>
<para>
Multiple EXCEPT operators in the same SELECT statement are
evaluated left to right.
</para>
</refsect2>
</refsect2>
</refsect1>
</refsect1>
<refsect1 id="R1-SQL-SELECT-2">
<refsect1 id="R1-SQL-SELECT-2">
<title>
<title>
...
@@ -633,7 +706,7 @@ SELECT [ ALL | DISTINCT ] <replaceable class="PARAMETER">expression</replaceable
...
@@ -633,7 +706,7 @@ SELECT [ ALL | DISTINCT ] <replaceable class="PARAMETER">expression</replaceable
[ WHERE <replaceable class="PARAMETER">condition</replaceable> ]
[ WHERE <replaceable class="PARAMETER">condition</replaceable> ]
[ GROUP BY <replaceable class="PARAMETER">column</replaceable> [, ...] ]
[ GROUP BY <replaceable class="PARAMETER">column</replaceable> [, ...] ]
[ HAVING <replaceable class="PARAMETER">condition</replaceable> [, ...] ]
[ HAVING <replaceable class="PARAMETER">condition</replaceable> [, ...] ]
[
UNION [ ALL ]
<replaceable class="PARAMETER">select</replaceable>]
[
{ UNION [ALL] | INTERSECT | EXCEPT }
<replaceable class="PARAMETER">select</replaceable>]
[ ORDER BY <replaceable class="PARAMETER">column</replaceable> [ ASC | DESC ] [, ...] ]
[ ORDER BY <replaceable class="PARAMETER">column</replaceable> [ ASC | DESC ] [, ...] ]
</synopsis>
</synopsis>
...
...
doc/src/sgml/sql.sgml
View file @
0d01fd4e
...
@@ -463,7 +463,7 @@ used to retrieve data. The syntax is:
...
@@ -463,7 +463,7 @@ used to retrieve data. The syntax is:
[WHERE condition]
[WHERE condition]
[GROUP BY <name_of_attr_i>
[GROUP BY <name_of_attr_i>
[,... [, <name_of_attr_j>]] [HAVING condition]]
[,... [, <name_of_attr_j>]] [HAVING condition]]
[{UNION | INTERSECT | EXCEPT} SELECT ...]
[{UNION
[ALL]
| INTERSECT | EXCEPT} SELECT ...]
[ORDER BY <name_of_attr_i> [ASC|DESC]
[ORDER BY <name_of_attr_i> [ASC|DESC]
[, ... [, <name_of_attr_j> [ASC|DESC]]]];
[, ... [, <name_of_attr_j> [ASC|DESC]]]];
\end{verbatim}
\end{verbatim}
...
...
src/bin/psql/psqlHelp.h
View file @
0d01fd4e
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: psqlHelp.h,v 1.
59 1999/02/13 23:20:40
momjian Exp $
* $Id: psqlHelp.h,v 1.
60 1999/03/19 02:41:36
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -108,7 +108,7 @@ static struct _helpStruct QL_HELP[] = {
...
@@ -108,7 +108,7 @@ static struct _helpStruct QL_HELP[] = {
"define a new rule"
,
"define a new rule"
,
"\
"\
\t
CREATE RULE rule_name AS ON
\n
\
\t
CREATE RULE rule_name AS ON
\n
\
\t
[SELECT|UPDATE|DELETE|INSERT]
\n
\
\t
{ SELECT | UPDATE | DELETE | INSERT }
\n
\
\t
TO object [WHERE qual]
\n
\
\t
TO object [WHERE qual]
\n
\
\t
DO [INSTEAD] [action|NOTHING|[actions]];"
},
\t
DO [INSTEAD] [action|NOTHING|[actions]];"
},
{
"create sequence"
,
{
"create sequence"
,
...
@@ -175,7 +175,7 @@ static struct _helpStruct QL_HELP[] = {
...
@@ -175,7 +175,7 @@ static struct _helpStruct QL_HELP[] = {
\t
[GROUP BY group_list]
\n
\
\t
[GROUP BY group_list]
\n
\
\t
[HAVING having_clause]
\n
\
\t
[HAVING having_clause]
\n
\
\t
[ORDER BY attr1 [USING op1], ...attrN]
\n
\
\t
[ORDER BY attr1 [USING op1], ...attrN]
\n
\
\t
[
UNION [ALL]
SELECT ...];"
},
\t
[
{ UNION [ALL] | INTERSECT | EXCEPT }
SELECT ...];"
},
{
"delete"
,
{
"delete"
,
"delete tuples"
,
"delete tuples"
,
"\
"\
...
@@ -258,8 +258,8 @@ static struct _helpStruct QL_HELP[] = {
...
@@ -258,8 +258,8 @@ static struct _helpStruct QL_HELP[] = {
"grant access control to a user or group"
,
"grant access control to a user or group"
,
"\
"\
\t
GRANT privilege1, ...privilegeN ON rel1, ...relN TO
\n
\
\t
GRANT privilege1, ...privilegeN ON rel1, ...relN TO
\n
\
[PUBLIC|GROUP group|username]
\n
\
{ PUBLIC | GROUP group | username }
\n
\
\t
privilege is
ALL|SELECT|INSERT|UPDATE|DELETE|RULE
"
},
\t
privilege is
{ ALL | SELECT | INSERT | UPDATE | DELETE | RULE }
"
},
{
"insert"
,
{
"insert"
,
"insert tuples"
,
"insert tuples"
,
"\
"\
...
@@ -271,7 +271,7 @@ static struct _helpStruct QL_HELP[] = {
...
@@ -271,7 +271,7 @@ static struct _helpStruct QL_HELP[] = {
\t
[WHERE qual]
\n
\
\t
[WHERE qual]
\n
\
\t
[GROUP BY group_list]
\n
\
\t
[GROUP BY group_list]
\n
\
\t
[HAVING having_clause]
\n
\
\t
[HAVING having_clause]
\n
\
\t
[
UNION [ALL]
SELECT ...];"
},
\t
[
{ UNION [ALL] | INTERSECT | EXCEPT }
SELECT ...];"
},
{
"listen"
,
{
"listen"
,
"listen for notification on a condition name"
,
"listen for notification on a condition name"
,
"\
"\
...
@@ -305,8 +305,8 @@ static struct _helpStruct QL_HELP[] = {
...
@@ -305,8 +305,8 @@ static struct _helpStruct QL_HELP[] = {
"revoke access control from a user or group"
,
"revoke access control from a user or group"
,
"\
"\
\t
REVOKE privilege1, ...privilegeN ON rel1, ...relN FROM
\n
\
\t
REVOKE privilege1, ...privilegeN ON rel1, ...relN FROM
\n
\
[PUBLIC|GROUP group|username]
\n
\
{ PUBLIC | GROUP group | username }
\n
\
\t
privilege is
ALL|SELECT|INSERT|UPDATE|DELETE|RULE
"
},
\t
privilege is
{ ALL | SELECT | INSERT | UPDATE | DELETE | RULE }
"
},
{
"rollback work"
,
{
"rollback work"
,
"abort a transaction"
,
"abort a transaction"
,
"\
"\
...
@@ -321,7 +321,7 @@ static struct _helpStruct QL_HELP[] = {
...
@@ -321,7 +321,7 @@ static struct _helpStruct QL_HELP[] = {
\t
[GROUP BY group_list]
\n
\
\t
[GROUP BY group_list]
\n
\
\t
[HAVING having_clause]
\n
\
\t
[HAVING having_clause]
\n
\
\t
[ORDER BY attr1 [ASC|DESC] [USING op1], ...attrN ]
\n
\
\t
[ORDER BY attr1 [ASC|DESC] [USING op1], ...attrN ]
\n
\
\t
[
UNION [ALL]
SELECT ...];"
},
\t
[
{ UNION [ALL] | INTERSECT | EXCEPT }
SELECT ...];"
},
{
"set"
,
{
"set"
,
"set run-time environment"
,
"set run-time environment"
,
#ifdef MULTIBYTE
#ifdef MULTIBYTE
...
...
src/man/select.l
View file @
0d01fd4e
.\" This is -*-nroff-*-
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
.\" XXX standard disclaimer belongs here....
.\" $Header: /cvsroot/pgsql/src/man/Attic/select.l,v 1.1
1 1999/02/02 03:45:32
momjian Exp $
.\" $Header: /cvsroot/pgsql/src/man/Attic/select.l,v 1.1
2 1999/03/19 02:41:41
momjian Exp $
.TH SELECT SQL 11/05/95 PostgreSQL PostgreSQL
.TH SELECT SQL 11/05/95 PostgreSQL PostgreSQL
.SH NAME
.SH NAME
select - retrieve instances from a class
select - retrieve instances from a class
...
@@ -15,7 +15,7 @@ select - retrieve instances from a class
...
@@ -15,7 +15,7 @@ select - retrieve instances from a class
[\fBgroup by\fR attr_name1 {, attr_name-i....}]
[\fBgroup by\fR attr_name1 {, attr_name-i....}]
[\fBhaving\fR having-clause]
[\fBhaving\fR having-clause]
[\fBorder by\fR attr_name1 [\fBasc\fR | \fBdesc\fR] [\fBusing op1\fR] {, attr_namei...}]
[\fBorder by\fR attr_name1 [\fBasc\fR | \fBdesc\fR] [\fBusing op1\fR] {, attr_namei...}]
[
\fBunion {all}
select\fR ...]
[
{ \fBunion {all}\fR | \fBintersect\fR | \fBexcept\fR } \fB
select\fR ...]
.fi
.fi
.SH DESCRIPTION
.SH DESCRIPTION
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment