mirror of
https://github.com/postgres/postgres.git
synced 2025-07-17 06:41:09 +03:00
Copy-editing.
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.25 2001/11/21 05:53:40 thomas Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.26 2001/11/23 21:08:51 tgl Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<chapter id="tutorial-advanced">
|
<chapter id="tutorial-advanced">
|
||||||
@ -132,7 +132,7 @@ ERROR: <unnamed> referential integrity violation - key referenced from we
|
|||||||
<para>
|
<para>
|
||||||
The behavior of foreign keys can be finely tuned to your
|
The behavior of foreign keys can be finely tuned to your
|
||||||
application. We will not go beyond this simple example in this
|
application. We will not go beyond this simple example in this
|
||||||
tutorial and refer you to the <citetitle>Reference
|
tutorial, but just refer you to the <citetitle>Reference
|
||||||
Manual</citetitle> for more information. Making correct use of
|
Manual</citetitle> for more information. Making correct use of
|
||||||
foreign keys will definitely improve the quality of your database
|
foreign keys will definitely improve the quality of your database
|
||||||
applications, so you are strongly encouraged to learn about them.
|
applications, so you are strongly encouraged to learn about them.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.21 2001/11/19 05:37:53 tgl Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.22 2001/11/23 21:08:51 tgl Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<chapter id="tutorial-sql">
|
<chapter id="tutorial-sql">
|
||||||
@ -15,8 +15,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.21 2001/11/19 05:37:53 tgl E
|
|||||||
way a complete tutorial on <acronym>SQL</acronym>. Numerous books
|
way a complete tutorial on <acronym>SQL</acronym>. Numerous books
|
||||||
have been written on <acronym>SQL92</acronym>, including <xref
|
have been written on <acronym>SQL92</acronym>, including <xref
|
||||||
linkend="MELT93"> and <xref linkend="DATE97">.
|
linkend="MELT93"> and <xref linkend="DATE97">.
|
||||||
You should be aware that some language
|
You should be aware that some <productname>PostgreSQL</productname>
|
||||||
features are extensions to the standard.
|
language features are extensions to the standard.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@ -44,7 +44,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.21 2001/11/19 05:37:53 tgl E
|
|||||||
|
|
||||||
The <literal>\i</literal> command reads in commands from the
|
The <literal>\i</literal> command reads in commands from the
|
||||||
specified file. The <literal>-s</literal> option puts you in
|
specified file. The <literal>-s</literal> option puts you in
|
||||||
single step mode which pauses before sending a query to the
|
single step mode which pauses before sending each query to the
|
||||||
server. The commands used in this section are in the file
|
server. The commands used in this section are in the file
|
||||||
<filename>basics.sql</filename>.
|
<filename>basics.sql</filename>.
|
||||||
</para>
|
</para>
|
||||||
@ -78,11 +78,12 @@ $Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.21 2001/11/19 05:37:53 tgl E
|
|||||||
<indexterm><primary>column</primary></indexterm>
|
<indexterm><primary>column</primary></indexterm>
|
||||||
|
|
||||||
Each table is a named collection of <firstterm>rows</firstterm>.
|
Each table is a named collection of <firstterm>rows</firstterm>.
|
||||||
Each row has the same set of named <firstterm>columns</firstterm>,
|
Each row of a given table has the same set of named
|
||||||
|
<firstterm>columns</firstterm>,
|
||||||
and each column is of a specific data type. Whereas columns have
|
and each column is of a specific data type. Whereas columns have
|
||||||
a fixed order in each row, it is important to remember that SQL
|
a fixed order in each row, it is important to remember that SQL
|
||||||
does not guarantee the order of the rows within the table in any
|
does not guarantee the order of the rows within the table in any
|
||||||
way (unless they are explicitly sorted).
|
way (although they can be explicitly sorted for display).
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@ -200,7 +201,10 @@ DROP TABLE <replaceable>tablename</replaceable>;
|
|||||||
INSERT INTO weather VALUES ('San Francisco', 46, 50, 0.25, '1994-11-27');
|
INSERT INTO weather VALUES ('San Francisco', 46, 50, 0.25, '1994-11-27');
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
Note that all data types use rather obvious input formats. The
|
Note that all data types use rather obvious input formats.
|
||||||
|
Constants that are not simple numeric values usually must be
|
||||||
|
surrounded by single quotes (<literal>'</>), as in the example.
|
||||||
|
The
|
||||||
<type>date</type> column is actually quite flexible in what it
|
<type>date</type> column is actually quite flexible in what it
|
||||||
accepts, but for this tutorial we will stick to the unambiguous
|
accepts, but for this tutorial we will stick to the unambiguous
|
||||||
format shown here.
|
format shown here.
|
||||||
@ -223,7 +227,7 @@ INSERT INTO weather (city, temp_lo, temp_hi, prcp, date)
|
|||||||
VALUES ('San Francisco', 43, 57, 0.0, '1994-11-29');
|
VALUES ('San Francisco', 43, 57, 0.0, '1994-11-29');
|
||||||
</programlisting>
|
</programlisting>
|
||||||
You can list the columns in a different order if you wish or
|
You can list the columns in a different order if you wish or
|
||||||
even omit some columns, e.g., unknown precipitation:
|
even omit some columns, e.g., if the precipitation is unknown:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
INSERT INTO weather (date, city, temp_hi, temp_lo)
|
INSERT INTO weather (date, city, temp_hi, temp_lo)
|
||||||
VALUES ('1994-11-29', 'Hayward', 54, 37);
|
VALUES ('1994-11-29', 'Hayward', 54, 37);
|
||||||
@ -654,7 +658,9 @@ SELECT city, max(temp_lo)
|
|||||||
(2 rows)
|
(2 rows)
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
which gives us one output row per city. We can filter these grouped
|
which gives us one output row per city. Each aggregate result is
|
||||||
|
computed over the table rows matching that city.
|
||||||
|
We can filter these grouped
|
||||||
rows using <literal>HAVING</literal>:
|
rows using <literal>HAVING</literal>:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
@ -671,8 +677,9 @@ SELECT city, max(temp_lo)
|
|||||||
(1 row)
|
(1 row)
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
which gives us the same results for only the cities that have some
|
which gives us the same results for only the cities that have all
|
||||||
below-forty readings. Finally, if we only care about cities whose
|
<literal>temp_lo</> values below forty. Finally, if we only care about
|
||||||
|
cities whose
|
||||||
names begin with <quote><literal>S</literal></quote>, we might do
|
names begin with <quote><literal>S</literal></quote>, we might do
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/start.sgml,v 1.19 2001/11/21 06:09:45 thomas Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/start.sgml,v 1.20 2001/11/23 21:08:51 tgl Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<chapter id="tutorial-start">
|
<chapter id="tutorial-start">
|
||||||
@ -160,7 +160,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/start.sgml,v 1.19 2001/11/21 06:09:45 thoma
|
|||||||
<screen>
|
<screen>
|
||||||
CREATE DATABASE
|
CREATE DATABASE
|
||||||
</screen>
|
</screen>
|
||||||
Is so, this step was successful and you can skip over the
|
If so, this step was successful and you can skip over the
|
||||||
remainder of this section.
|
remainder of this section.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ createdb: command not found
|
|||||||
installed at all or the search path was not set correctly. Try
|
installed at all or the search path was not set correctly. Try
|
||||||
calling the command with an absolute path instead:
|
calling the command with an absolute path instead:
|
||||||
<screen>
|
<screen>
|
||||||
<prompt>$</prompt> <userinput>/usr/local/pgsql/bin/createdb</userinput>
|
<prompt>$</prompt> <userinput>/usr/local/pgsql/bin/createdb mydb</userinput>
|
||||||
</screen>
|
</screen>
|
||||||
The path at your site might be different. Contact your site
|
The path at your site might be different. Contact your site
|
||||||
administrator or check back in the installation instructions to
|
administrator or check back in the installation instructions to
|
||||||
@ -249,7 +249,7 @@ createdb: database creation failed
|
|||||||
<screen>
|
<screen>
|
||||||
<prompt>$</prompt> <userinput>dropdb mydb</userinput>
|
<prompt>$</prompt> <userinput>dropdb mydb</userinput>
|
||||||
</screen>
|
</screen>
|
||||||
(In this case, the database name does not default to the user
|
(For this command, the database name does not default to the user
|
||||||
account name. You always need to specify it.) This action
|
account name. You always need to specify it.) This action
|
||||||
physically removes all files associated with the database and
|
physically removes all files associated with the database and
|
||||||
cannot be undone, so this should only be done with a great deal of
|
cannot be undone, so this should only be done with a great deal of
|
||||||
|
Reference in New Issue
Block a user