Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb106421

Browse files
author
Thomas G. Lockhart
committed
More complete info from Oliver Elphick.
1 parentad4b27a commitb106421

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

‎doc/src/sgml/ref/copy.sgml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,11 @@ has the termination sequence on the last line):
395395
</refsect1>
396396

397397
<refsect1 ID="R1-SQL-COPY-5">
398-
<title>Bugs</title>
398+
<title>Bugs and features</title>
399+
<para>
400+
<command>COPY</command> neither invokes rules nor acts on column defaults.
401+
It does invoke triggers, however.
402+
</para>
399403
<para>
400404
<command>COPY</command> stops operation at the first error. This
401405
should not lead to problems in the event of

‎doc/src/sgml/ref/select.sgml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,15 @@ SELECT [ALL|DISTINCT [ON <replaceable class="PARAMETER">column</replaceable>] ]
205205
Description
206206
</title>
207207
<para>
208-
<command>SELECT</command> will get all rows which satisfy the
209-
WHERE condition
210-
or all rows of a table if WHERE is omitted.</para>
208+
<command>SELECT</command> will return rows from one or more tables.
209+
Candidates for selection are rows which satisfy the WHERE condition;
210+
if WHERE is omitted, all rows are candidates.</para>
211+
<para>
212+
<command>DISTINCT</command> will eliminate all duplicate rows from the
213+
selection.
214+
<command>DISTINCT ON <replaceable class="PARAMETER">column</replaceable></command> will eliminate all duplicates in the specified column; this is
215+
equivalent to using <command>GROUP BY <replaceable class="PARAMETER">column</replaceable></command>. <command>ALL</command> will return all candidate rows,
216+
including duplicates.
211217

212218
<para>
213219
The GROUP BY clause allows a user to divide a table
@@ -247,8 +253,9 @@ WHERE <replaceable class="PARAMETER">expr</replaceable> <replaceable class="PARA
247253
</synopsis>
248254

249255
where <replaceable class="PARAMETER">cond_op</replaceable> can be
250-
one of: =, &lt;, &lt;=, &gt;, &gt;=, &lt;&gt;
251-
or a conditional operator like ALL, ANY, IN, LIKE, et cetera
256+
one of: =, &lt;, &lt;=, &gt;, &gt;= or &lt;&gt;,
257+
a conditional operator like ALL, ANY, IN, LIKE, et cetera or a
258+
locally-defined operator,
252259
and <replaceable class="PARAMETER">log_op</replaceable> can be one
253260
of: AND, OR, NOT.
254261
The comparison returns either TRUE or FALSE and all
@@ -266,10 +273,16 @@ WHERE <replaceable class="PARAMETER">expr</replaceable> <replaceable class="PARA
266273
</title>
267274
<para>
268275
GROUP BY specifies a grouped table derived by the application
269-
ofthethis clause:
276+
of this clause:
270277
<synopsis>
271278
GROUP BY <replaceable class="PARAMETER">column</replaceable> [, ...]
272-
</synopsis></para></refsect2>
279+
</synopsis></para>
280+
<para>
281+
GROUP BY will condense into a single row all rows that share the same values for the
282+
grouped columns; aggregates return values derived from all rows that make up the group. The value returned for an ungrouped
283+
and unaggregated column is dependent on the order in which rows happen to be read from the database.
284+
</para>
285+
</refsect2>
273286

274287
<refsect2 id="R2-SQL-HAVING-2">
275288
<refsect2info>
@@ -327,8 +340,8 @@ SELECT title, date_prod + 1 AS newlen FROM films ORDER BY newlen;
327340
</programlisting></para>
328341

329342
<para>
330-
Thecolumns in the ORDER BYmust appear in the SELECT clause.
331-
Thus the following statement isillegal:
343+
From release 6.4 of PostgreSQL, thecolumns in the ORDER BYclause do not need to appear in the SELECT clause.
344+
Thus the following statement isnow legal:
332345
<programlisting>
333346
SELECT name FROM distributors ORDER BY code;
334347
</programlisting></para>
@@ -409,7 +422,7 @@ SELECT f.title, f.did, d.name, f.date_prod, f.kind
409422
</programlisting>
410423
<para>
411424
To sum the column <literal>len</literal> of all films and group
412-
thereults by <literal>kind</literal>:
425+
theresults by <literal>kind</literal>:
413426
</para>
414427
<programlisting>
415428
SELECT kind, SUM(len) AS total FROM films GROUP BY kind;
@@ -425,7 +438,7 @@ SELECT kind, SUM(len) AS total FROM films GROUP BY kind;
425438

426439
<para>
427440
To sum the column <literal>len</literal> of all films, group
428-
thereults by <literal>kind</literal> and show those group totals
441+
theresults by <literal>kind</literal> and show those group totals
429442
that are less than 5 hours:
430443
</para>
431444
<programlisting>
@@ -563,6 +576,10 @@ SELECT distributors.* WHERE name = 'Westwood';
563576
This is not currently
564577
allowed in <productname>Postgres</productname>.
565578
</para>
579+
580+
<para>
581+
The DISTINCT ON phrase is not part of <acronym>SQL92</acronym>.
582+
</para>
566583
</refsect3>
567584

568585
<refsect3 id="R3-SQL-UNION-1">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp