11<!--
2- $Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.21 2001/11/19 05:37:53 tgl Exp $
2+ $Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.22 2001/11/23 21:08:51 tgl Exp $
33-->
44
55 <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
1515 way a complete tutorial on <acronym>SQL</acronym>. Numerous books
1616 have been written on <acronym>SQL92</acronym>, including <xref
1717 linkend="MELT93"> and <xref linkend="DATE97">.
18- You should be aware that somelanguage
19- features are extensions to the standard.
18+ You should be aware that some<productname>PostgreSQL</productname>
19+ language features are extensions to the standard.
2020 </para>
2121
2222 <para>
@@ -44,7 +44,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.21 2001/11/19 05:37:53 tgl E
4444
4545 The <literal>\i</literal> command reads in commands from the
4646 specified file. The <literal>-s</literal> option puts you in
47- single step mode which pauses before sendinga query to the
47+ single step mode which pauses before sendingeach query to the
4848 server. The commands used in this section are in the file
4949 <filename>basics.sql</filename>.
5050 </para>
@@ -78,11 +78,12 @@ $Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.21 2001/11/19 05:37:53 tgl E
7878 <indexterm><primary>column</primary></indexterm>
7979
8080 Each table is a named collection of <firstterm>rows</firstterm>.
81- Each row has the same set of named <firstterm>columns</firstterm>,
81+ Each row of a given table has the same set of named
82+ <firstterm>columns</firstterm>,
8283 and each column is of a specific data type. Whereas columns have
8384 a fixed order in each row, it is important to remember that SQL
8485 does not guarantee the order of the rows within the table in any
85- way (unless theyare explicitly sorted).
86+ way (although theycan be explicitly sorted for display ).
8687 </para>
8788
8889 <para>
@@ -200,7 +201,10 @@ DROP TABLE <replaceable>tablename</replaceable>;
200201INSERT INTO weather VALUES ('San Francisco', 46, 50, 0.25, '1994-11-27');
201202</programlisting>
202203
203- Note that all data types use rather obvious input formats. The
204+ Note that all data types use rather obvious input formats.
205+ Constants that are not simple numeric values usually must be
206+ surrounded by single quotes (<literal>'</>), as in the example.
207+ The
204208 <type>date</type> column is actually quite flexible in what it
205209 accepts, but for this tutorial we will stick to the unambiguous
206210 format shown here.
@@ -223,7 +227,7 @@ INSERT INTO weather (city, temp_lo, temp_hi, prcp, date)
223227 VALUES ('San Francisco', 43, 57, 0.0, '1994-11-29');
224228</programlisting>
225229 You can list the columns in a different order if you wish or
226- even omit some columns, e.g.,unknown precipitation:
230+ even omit some columns, e.g.,if the precipitation is unknown :
227231<programlisting>
228232INSERT INTO weather (date, city, temp_hi, temp_lo)
229233 VALUES ('1994-11-29', 'Hayward', 54, 37);
@@ -654,7 +658,9 @@ SELECT city, max(temp_lo)
654658(2 rows)
655659</screen>
656660
657- which gives us one output row per city. We can filter these grouped
661+ which gives us one output row per city. Each aggregate result is
662+ computed over the table rows matching that city.
663+ We can filter these grouped
658664 rows using <literal>HAVING</literal>:
659665
660666<programlisting>
@@ -671,8 +677,9 @@ SELECT city, max(temp_lo)
671677(1 row)
672678</screen>
673679
674- which gives us the same results for only the cities that have some
675- below-forty readings. Finally, if we only care about cities whose
680+ which gives us the same results for only the cities that have all
681+ <literal>temp_lo</> values below forty. Finally, if we only care about
682+ cities whose
676683 names begin with <quote><literal>S</literal></quote>, we might do
677684
678685<programlisting>