From c30446b9c901b357f9a7b859c51bee5740ac313f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 17 Jun 2009 21:58:49 +0000 Subject: Proofreading for Bruce's recent round of documentation proofreading. Most of those changes were good, but some not so good ... --- doc/src/sgml/query.sgml | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'doc/src/sgml/query.sgml') diff --git a/doc/src/sgml/query.sgml b/doc/src/sgml/query.sgml index c81c321134b..49a1221ea0f 100644 --- a/doc/src/sgml/query.sgml +++ b/doc/src/sgml/query.sgml @@ -1,4 +1,4 @@ - + The <acronym>SQL</acronym> Language @@ -53,7 +53,7 @@ The \i command reads in commands from the - specified file. The psql -s option puts you in + specified file. psql's -s option puts you in single step mode which pauses before sending each statement to the server. The commands used in this section are in the file basics.sql. @@ -150,7 +150,7 @@ CREATE TABLE weather ( int is the normal integer type. real is a type for storing single precision floating-point numbers. date should be self-explanatory. (Yes, the column of - type date is also named date. + type date is also named date. This might be convenient or confusing — you choose.) @@ -165,7 +165,7 @@ CREATE TABLE weather ( and a rich set of geometric types. PostgreSQL can be customized with an arbitrary number of user-defined data types. Consequently, type - names are not special key words in the syntax except where required to + names are not key words in the syntax, except where required to support special cases in the SQL standard. @@ -291,7 +291,7 @@ COPY weather FROM '/home/user/weather.txt'; tables from which to retrieve the data), and an optional qualification (the part that specifies any restrictions). For example, to retrieve all the rows of table - weather, type: + weather, type: SELECT * FROM weather; @@ -450,9 +450,10 @@ SELECT DISTINCT city of the same or different tables at one time is called a join query. As an example, say you wish to list all the weather records together with the location of the - 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, and select the pairs of rows where these values match. + 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, and select the pairs of rows where these values match. This is only a conceptual model. The join is usually performed @@ -485,8 +486,8 @@ SELECT * There is no result row for the city of Hayward. This is because there is no matching entry in the - cities table for Hayward, so the join - ignores the unmatched rows in the weather table. We will see + cities table for Hayward, so the join + ignores the unmatched rows in the weather table. We will see shortly how this can be fixed. @@ -494,9 +495,9 @@ SELECT * There are two columns containing the city name. This is - correct because the columns from the - weather and the - cities tables are concatenated. In + correct because the lists of columns from the + weather and + cities tables are concatenated. In practice this is undesirable, though, so you will probably want to list the output columns explicitly rather than using *: @@ -556,10 +557,10 @@ SELECT * Now we will figure out how we can get the Hayward records back in. What we want the query to do is to scan the - weather table and for each row to find the - matching cities row(s). If no matching row is + weather table and for each row to find the + matching cities row(s). If no matching row is found we want some empty values to be substituted - for the cities table's columns. This kind + for the cities table's columns. This kind of query is called an outer join. (The joins we have seen so far are inner joins.) The command looks like this: @@ -603,10 +604,10 @@ SELECT * to find all the weather records that are in the temperature range of other weather records. So we need to compare the temp_lo and temp_hi columns of - each weather row to the + each weather row to the temp_lo and temp_hi columns of all other - weather rows. We can do this with the + weather rows. We can do this with the following query: @@ -756,7 +757,7 @@ SELECT city, max(temp_lo) which gives us the same results for only the cities that have all - temp_lo values below 40. Finally, if we only care about + temp_lo values below 40. Finally, if we only care about cities whose names begin with S, we might do: -- cgit v1.2.3