Commit 375dcf9c authored by Tom Lane's avatar Tom Lane

Fix a few typos, grammatical problems, etc in new tutorial material.

Overall a really nice job here, Peter ...
parent 9b03776f
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.22 2001/09/02 23:27:49 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.23 2001/11/19 05:37:53 tgl Exp $
-->
<chapter id="tutorial-advanced">
......@@ -10,9 +10,9 @@ $Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.22 2001/09/02 23:27:49 pe
<para>
In the previous chapter we have covered the basics of using
<acronym>SQL</acronym> to store and access your data in a
<acronym>SQL</acronym> to store and access your data in
<productname>PostgreSQL</productname>. We will now discuss some
more advanced features of <acronym>SQL</acronym> that simplify the
more advanced features of <acronym>SQL</acronym> that simplify
management and prevent loss or corruption of your data. Finally,
we will look at some <productname>PostgreSQL</productname>
extensions.
......@@ -82,7 +82,7 @@ SELECT * FROM myview;
</indexterm>
<para>
Recall the <classname>weather</classname> and the
Recall the <classname>weather</classname> and
<classname>cities</classname> tables from <xref
linkend="tutorial-sql">. Consider the following problem: You
want to make sure that no one can insert rows in the
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.20 2001/11/08 23:34:33 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.21 2001/11/19 05:37:53 tgl Exp $
-->
<chapter id="tutorial-sql">
......@@ -26,7 +26,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.20 2001/11/08 23:34:33 peter
</para>
<para>
Examples in this manual can also be found in source distribution
Examples in this manual can also be found in the
<productname>PostgreSQL</productname> source distribution
in the directory <filename>src/tutorial/</filename>. Refer to the
<filename>README</filename> file in that directory for how to use
them. To start the tutorial, do the following:
......@@ -42,7 +43,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.20 2001/11/08 23:34:33 peter
</screen>
The <literal>\i</literal> command reads in commands from the
specified files. 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
server. The commands used in this section are in the file
<filename>basics.sql</filename>.
......@@ -126,7 +127,7 @@ CREATE TABLE weather (
differently than above, or even all on one line. Two dashes
(<quote><literal>--</literal></quote>) introduce comments.
Whatever follows them is ignored up to the end of the line. SQL
is also case insensitive about key words and identifiers, except
is case insensitive about key words and identifiers, except
when identifiers are double-quoted to preserve the case (not done
above).
</para>
......@@ -148,7 +149,7 @@ CREATE TABLE weather (
precision</type>, <type>char(<replaceable>N</>)</type>,
<type>varchar(<replaceable>N</>)</type>, <type>date</type>,
<type>time</type>, <type>timestamp</type>, and
<type>interval</type> as well as other types of general utility
<type>interval</type>, as well as other types of general utility
and a rich set of geometric types.
<productname>PostgreSQL</productname> can be customized with an
arbitrary number of user-defined data types. Consequently, type
......@@ -165,7 +166,7 @@ CREATE TABLE cities (
location point
);
</programlisting>
The <type>point</type> type is such a
The <type>point</type> type is an example of a
<productname>PostgreSQL</productname>-specific data type.
</para>
......@@ -221,7 +222,7 @@ INSERT INTO cities VALUES ('San Francisco', '(-194.0, 53.0)');
INSERT INTO weather (city, temp_lo, temp_hi, prcp, date)
VALUES ('San Francisco', 43, 57, 0.0, '1994-11-29');
</programlisting>
You can also 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:
<programlisting>
INSERT INTO weather (date, city, temp_hi, temp_lo)
......@@ -279,7 +280,7 @@ COPY weather FROM '/home/user/weather.txt';
<programlisting>
SELECT * FROM weather;
</programlisting>
(where <literal>*</literal> means <quote>all columns</quote>) and
(here <literal>*</literal> means <quote>all columns</quote>) and
the output should be:
<screen>
city | temp_lo | temp_hi | prcp | date
......@@ -373,9 +374,9 @@ SELECT DISTINCT city
of the same or different tables at one time is called a
<firstterm>join</firstterm> query. As an example, say you wish to
list all the weather records together with the location of the
associated city. In effect, we need to compare the city column of
associated city. To do that, we need to compare the city column of
each row of the weather table with the name column of all rows in
the cities table.
the cities table, and select the pairs of rows where these values match.
<note>
<para>
This is only a conceptual model. The actual join may
......@@ -409,7 +410,7 @@ SELECT *
There is no result row for the city of Hayward. This is
because there is no matching entry in the
<classname>cities</classname> table for Hayward, so the join
cannot process the rows in the weather table. We will see
ignores the unmatched rows in the weather table. We will see
shortly how this can be fixed.
</para>
</listitem>
......@@ -478,7 +479,7 @@ SELECT *
found we want some <quote>empty values</quote> to be substituted
for the <classname>cities</classname> table's columns. This kind
of query is called an <firstterm>outer join</firstterm>. (The
joins we have seen to far are inner joins.) The command looks
joins we have seen so far are inner joins.) The command looks
like this:
<programlisting>
......@@ -493,12 +494,13 @@ SELECT *
(3 rows)
</programlisting>
In particular, this query is a <firstterm>left outer
This query is called a <firstterm>left outer
join</firstterm> because the table mentioned on the left of the
join operator will have each of its rows in the output at least
once, whereas the table on the right will only have those rows
output that match some row of the left table, and will have empty
values substituted appropriately.
output that match some row of the left table. When outputting a
left-table row for which there is no right-table match, empty (NULL)
values are substituted for the right-table columns.
</para>
<formalpara>
......@@ -605,7 +607,11 @@ SELECT city FROM weather WHERE temp_lo = max(temp_lo); <lineannotation>WRONG
but this will not work since the aggregate
<function>max</function> cannot be used in the
<literal>WHERE</literal> clause. However, as is often the case
<literal>WHERE</literal> clause. (This restriction exists because
the <literal>WHERE</literal> clause determines the rows that will
go into the aggregation stage; so it has to be evaluated before
aggregate functions are computed.)
However, as is often the case
the query can be restated to accomplish the intended result; here
by using a <firstterm>subquery</firstterm>:
......@@ -697,7 +703,7 @@ SELECT city, max(temp_lo)
</para>
<para>
Note that we can apply the city name restriction in
Observe that we can apply the city name restriction in
<literal>WHERE</literal>, since it needs no aggregate. This is
more efficient than adding the restriction to <literal>HAVING</literal>,
because we avoid doing the grouping and aggregate calculations
......@@ -718,7 +724,7 @@ SELECT city, max(temp_lo)
<command>UPDATE</command> command.
Suppose you discover the temperature readings are
all off by 2 degrees as of November 28, you may update the
data as follow:
data as follows:
<programlisting>
UPDATE weather
......@@ -758,7 +764,7 @@ SELECT * FROM weather;
DELETE FROM weather WHERE city = 'Hayward';
</programlisting>
All weather recording belonging to Hayward are removed.
All weather records belonging to Hayward are removed.
<programlisting>
SELECT * FROM weather;
......@@ -779,10 +785,10 @@ SELECT * FROM weather;
DELETE FROM <replaceable>tablename</replaceable>;
</synopsis>
Without a qualification, <command>DELETE</command> will simply
remove all rows from the given table, leaving it
Without a qualification, <command>DELETE</command> will
remove <emphasis>all</> rows from the given table, leaving it
empty. The system will not request confirmation before
doing this.
doing this!
</para>
</sect1>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/start.sgml,v 1.17 2001/09/02 23:27:49 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/start.sgml,v 1.18 2001/11/19 05:37:53 tgl Exp $
-->
<chapter id="tutorial-start">
......@@ -104,8 +104,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/start.sgml,v 1.17 2001/09/02 23:27:49 peter
server can be on different hosts. In that case they communicate
over a TCP/IP network connection. You should keep this in mind,
because the files that can be accessed on a client machine might
not be accessible (or might only be accessed using a different
file name) on the database server machine.
not be accessible (or might only be accessible using a different
file path) on the database server machine.
</para>
<para>
......@@ -231,7 +231,7 @@ createdb: database creation failed
You can also create databases with other names.
<productname>PostgreSQL</productname> allows you to create any
number of databases at a given site. Database names must have an
alphabetic first character and are limited to 32 characters in
alphabetic first character and are limited to 31 characters in
length. A convenient choice is to create a database with the same
name as your current user name. Many tools assume that database
name as the default, so it can save you some typing. To create
......@@ -372,9 +372,9 @@ mydb=#
<para>
The <command>psql</command> program has a number of internal
commands that are not SQL commands. They begin the backslash
commands that are not SQL commands. They begin with the backslash
character, <quote><literal>\</literal></quote>. Some of these
commands were already listed in the welcome message. For example,
commands were listed in the welcome message. For example,
you can get help on the syntax of various
<productname>PostgreSQL</productname> <acronym>SQL</acronym>
commands by typing:
......@@ -396,7 +396,7 @@ mydb=#
installed correctly you can also type <literal>man psql</literal>
at the operating system shell prompt to see the documentation. In
this tutorial we will not use these features explicitly, but you
can use them yourself when you see it fit.
can use them yourself when you see fit.
</para>
</sect1>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment