/[gentoo]/xml/htdocs/doc/en/postgres-howto.xml
Gentoo

Contents of /xml/htdocs/doc/en/postgres-howto.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download) (as text)
Tue Mar 14 12:30:33 2006 UTC (11 years, 7 months ago) by neysx
Branch: MAIN
File MIME type: application/xml
#125892 new postgres howto

1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3 <!-- $Header$ -->
4
5 <guide link="/doc/en/postgres-howto.xml" lang="en">
6 <title>PostgreSQL Guide</title>
7
8 <author title="Author">
9 <mail link="chriswhite@gentoo.org">Chris White</mail>
10 </author>
11 <author title="Editor">
12 <mail link="neysx@gentoo.org">Xavier Neys</mail>
13 </author>
14
15 <abstract>
16 This guide is meant to show the basic setup of PostgreSQL. The setup described
17 here should be sufficient enough to use for basic web appplications, and any
18 other program that provides PostgreSQL support.
19 </abstract>
20
21 <!-- The content of this document is licensed under the CC-BY-SA license -->
22 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
23 <license/>
24
25 <version>1.0</version>
26 <date>2006-03-14</date>
27
28 <chapter>
29 <title>Introduction</title>
30 <section>
31 <title>PostgreSQL introduction</title>
32 <body>
33
34 <p>
35 When talking to most developers about the different database solutions to use,
36 two major databases will usually form the answer. One would be <c>MySQL</c>,
37 and the other is what this document will refer to, <c>PostgreSQL</c>. The
38 advantages of one over the other is a somewhat long winded debate, however it
39 is just to say that PostgreSQL has had a more firm grasp on true relational
40 database structure than MySQL. Most of the standard features such as
41 <b>FOREIGN KEY</b> was only just added in MySQL 5. However, whatever the case
42 may be, this document assumes that you have selected PostgreSQL as the
43 database to use. The first place to start is the <c>emerge</c> process. In the
44 next section, the installation process through emerge will be described, as
45 well as the basic configuration.
46 </p>
47
48 </body>
49 </section>
50 <section>
51 <title>PostgreSQL installation</title>
52 <body>
53
54 <p>
55 To begin, we must first <c>emerge</c> the PostgreSQL package. To do so, run the
56 following code to first ensure that the options for it are properly set:
57 </p>
58
59 <pre caption="Checking the PostgreSQL build options">
60 # <i>emerge -pv postgresql</i>
61
62 These are the packages that I would merge, in order:
63
64 Calculating dependencies ...done!
65 [ebuild N ] dev-db/postgresql-8.0.4 -doc -kerberos +libg++ +nls +pam +perl
66 -pg-hier -pg-intdatetime +python +readline (-selinux) +ssl -tcltk +xml2 +zlib 0 kB
67 </pre>
68
69 <p>
70 Here's a list of what the different build options indicate:
71 </p>
72
73 <table>
74 <tr>
75 <th>USE Flag</th>
76 <th>Meaning</th>
77 </tr>
78 <tr>
79 <ti>doc</ti>
80 <ti>
81 This USE flag enables or disables the installation of documentation
82 outside of the standard man pages. The one good time to disable this
83 option is if you are low on space, or you have alternate methods of
84 getting a hold of the documentation (online, etc.)
85 </ti>
86 </tr>
87 <tr>
88 <ti>kerberos</ti>
89 <ti>
90 When connecting to the database, with this option enabled, the admin
91 has the option of using <c>kerberos</c> to authenticate their
92 users/services to the database.
93 </ti>
94 </tr>
95 <tr>
96 <ti>libg++</ti>
97 <ti>
98 If this option is enabled, C++ bindings for PostgreSQL will be built.
99 This will build libpq++ for use by C++ programs to link against.
100 </ti>
101 </tr>
102 <tr>
103 <ti>nls</ti>
104 <ti>
105 If this option is enabled, PostgreSQL can utilized translated strings
106 for non-English speaking users.
107 </ti>
108 </tr>
109 <tr>
110 <ti>pam</ti>
111 <ti>
112 If this option is enabled, and the admin configures the PostgreSQL
113 configuration file properly, users/services will be able to login to a
114 PostgreSQL database using <c>PAM</c> (Pluggable Authentication Module).
115 </ti>
116 </tr>
117 <tr>
118 <ti>perl</ti>
119 <ti>
120 If this option is enabled, <c>perl</c> bindings for PostgreSQL will be
121 built.
122 </ti>
123 </tr>
124 <tr>
125 <ti>pg-hier</ti>
126 <ti>
127 If this option is enabled, a patch is applied to enable hierarchical
128 queries, such as those seen by the <c>CONNECT</c> statement in
129 <c>Oracle</c> database servers. More information on hierarchical queries
130 can be found in the <uri
131 link="http://www.lc.leidenuniv.nl/awcourse/oracle/server.920/a96540/
132 queries4a. htm">Oracle Reference Guide</uri>.
133 </ti>
134 </tr>
135 <tr>
136 <ti>pg-intdatetime</ti>
137 <ti>
138 If this option is enabled, PostgreSQL will support 64 bit integer date
139 types.
140 </ti>
141 </tr>
142 <tr>
143 <ti>python</ti>
144 <ti>
145 If this option is enabled, PostgreSQL will be built with
146 <c>python</c> bindings.
147 </ti>
148 </tr>
149 <tr>
150 <ti>readline</ti>
151 <ti>
152 If this option is enabled, PostgreSQL will support <c>readline</c> style
153 command line editing. This includes command history and isearch.
154 </ti>
155 </tr>
156 <tr>
157 <ti>selinux</ti>
158 <ti>
159 If this option is enabled, an <c>selinux</c> policy for PostgreSQL will be
160 installed.
161 </ti>
162 </tr>
163 <tr>
164 <ti>ssl</ti>
165 <ti>
166 If this option is enabled, PostgreSQL will utilize the <c>OpenSSL</c>
167 library to encrypt traffic between PostgreSQL clients and servers.
168 </ti>
169 </tr>
170 <tr>
171 <ti>tcltk</ti>
172 <ti>
173 If this option is enabled, PostgreSQL will build <c>tcl/tk</c> bindings.
174 </ti>
175 </tr>
176 <tr>
177 <ti>xml2</ti>
178 <ti>
179 If this option is enabled, <c>XPATH</c> style xml support will be built.
180 More information on using xml support with PostgreSQL can be found on:
181 <uri link="http://www.throwingbeans.org/tech/postgresql_and_xml.html">
182 PostgreSQL and XML</uri>.
183 </ti>
184 </tr>
185 <tr>
186 <ti>zlib</ti>
187 <ti>
188 This isn't really used by PostgreSQL itself, but by <c>pg_dump</c> to
189 compress the dumps it produces.
190 </ti>
191 </tr>
192 </table>
193
194 <note>
195 The <c>pg-hier</c> patch author has stopped working on the patch, and it will
196 most likely be removed in later versions.
197 </note>
198
199 <p>
200 Once you've customized PostgreSQL to meet your specific needs, go ahead and
201 start the <c>emerge</c>:
202 </p>
203
204 <pre caption="Emerge-ing PostgreSQL">
205 # <i>emerge postgresql</i>
206 <comment>(Output shortened)</comment>
207 >>> /usr/lib/libecpg.so.5 -> libecpg.so.5.0
208 >>> /usr/bin/postmaster -> postgres
209 * Make sure the postgres user in /etc/passwd has an account setup with /bin/bash as the shell
210 *
211 * Execute the following command
212 * emerge --config =postgresql-8.0.4
213 * to setup the initial database environment.
214 *
215 >>> Regenerating /etc/ld.so.cache...
216 >>> dev-db/postgresql-8.0.4 merged.
217 </pre>
218
219 <p>
220 As shown by the einfo output, there is some post setup that must be done. The
221 next chapter will look at the actual configuration of PostgreSQL.
222 </p>
223
224 </body>
225 </section>
226 </chapter>
227 <chapter>
228 <title>PostgreSQL configuration</title>
229 <section>
230 <title>Setting up the initial database environment</title>
231 <body>
232
233 <p>
234 As noted in the earlier <c>emerge</c> output, the initial database environment
235 must be setup. However, before this is done, one thing needs to be considered.
236 Unlike, say MySQL, PostgreSQL's "root" password is the password of the actual
237 user. However, only the user is created by the ebuild <e>not</e> the password.
238 So before we can begin, the password must be set for the postgres user:
239 </p>
240
241 <pre caption="Setting the password">
242 # <i>passwd postgres</i>
243 New UNIX password:
244 Retype new UNIX password:
245 passwd: password updated successfully
246 </pre>
247
248 <p>
249 Now that this is setup, the creation of the initial database environment can occur:
250 </p>
251
252 <pre caption="Configuring the database environment with emerge --config">
253 # <i>emerge --config =postgresql-8.0.4</i>
254
255
256 Configuring pkg...
257
258 * Creating the data directory ...
259 * Initializing the database ...
260 The files belonging to this database system will be owned by user "postgres".
261 This user must also own the server process.
262
263 The database cluster will be initialized with locale C.
264
265 fixing permissions on existing directory /var/lib/postgresql/data ... ok
266 creating directory /var/lib/postgresql/data/global ... ok
267 creating directory /var/lib/postgresql/data/pg_xlog ... ok
268 creating directory /var/lib/postgresql/data/pg_xlog/archive_status ... ok
269 creating directory /var/lib/postgresql/data/pg_clog ... ok
270 creating directory /var/lib/postgresql/data/pg_subtrans ... ok
271 creating directory /var/lib/postgresql/data/base ... ok
272 creating directory /var/lib/postgresql/data/base/1 ... ok
273 creating directory /var/lib/postgresql/data/pg_tblspc ... ok
274 selecting default max_connections ... 100
275 selecting default shared_buffers ... 1000
276 creating configuration files ... ok
277 creating template1 database in /var/lib/postgresql/data/base/1 ... ok
278 initializing pg_shadow ... ok
279 enabling unlimited row size for system tables ... ok
280 initializing pg_depend ... ok
281 creating system views ... ok
282 loading pg_description ... ok
283 creating conversions ... ok
284 setting privileges on built-in objects ... ok
285 creating information schema ... ok
286 vacuuming database template1 ... ok
287 copying template1 to template0 ... ok
288
289 WARNING: enabling "trust" authentication for local connections
290 You can change this by editing pg_hba.conf or using the -A option the
291 next time you run initdb.
292
293 Success. You can now start the database server using:
294
295 /usr/bin/postmaster -D /var/lib/postgresql/data
296 or
297 /usr/bin/pg_ctl -D /var/lib/postgresql/data -l logfile start
298
299 *
300 * You can use /etc/init.d/postgresql script to run PostgreSQL instead of pg_ctl.
301 *
302 </pre>
303
304 <p>
305 Now the initial database environment is setup. The next section will look at
306 verifying the install and setting up users to access the database.
307 </p>
308
309 </body>
310 </section>
311 <section>
312 <title>PostgreSQL database setup</title>
313 <body>
314
315 <p>
316 Now that PostgreSQL is setup, it's a good idea at this point to verify the
317 installation. First, make sure the service starts up ok:
318 </p>
319
320 <pre caption="Starting up the PostgreSQL service">
321 # <i>/etc/init.d/postgresql start</i>
322 * Starting PostgreSQL ... [ ok ]
323 </pre>
324
325 <p>
326 Once this is verified working, it's also a good idea to add it to the default
327 runlevel so it starts at boot:
328 </p>
329
330 <pre caption="Adding to the default runlevel">
331 # <i>rc-update add postgresql default</i>
332 * postgresql added to runlevel default
333 </pre>
334
335 <p>
336 Now that the service has started, it's time to try setting up a test database.
337 To start out, let's create a test database by using the <c>createdb</c>
338 command. We'll also pass along the <c>-U</c> option to set the user (it
339 defaults to the current user name if you don't), and the <c>-W</c> option to
340 request the password we created earlier. Finally we give it the name of the
341 database we want to create:
342 </p>
343
344 <pre caption="Creating a database with createdb">
345 $ <i>createdb -U postgres -W test</i>
346 Password:
347 CREATE DATABASE
348 </pre>
349
350 <p>
351 The database was successfully created, and we can confirm that the database can
352 run basic tasks. We'll go ahead and drop this database (remove it) with the
353 <c>dropdb</c> command, creating a new one for usage later on:
354 </p>
355
356 <pre caption="Droping a database with dropdb">
357 $ <i>dropdb -U postgres -W test</i>
358 Password:
359 DROP DATABASE
360 </pre>
361
362 <p>
363 Right now, only the postgres user can run commands. Obviously this is not the
364 sort of setup one would like in a multi-user environment. The next section will
365 look at working with user accounts.
366 </p>
367
368 </body>
369 </section>
370 <section>
371 <title>Setting up database user accounts</title>
372 <body>
373
374 <p>
375 As mentioned earlier, having to login as the postgres user is somewhat
376 undesirable in a mult-user environment. In most cases there will be various
377 users and services accessing the server, and each have different permission
378 requirements. So, to handle this, the <c>createuser</c> command can be used.
379 This command is an alternative to running a few SQL queries, and is a lot more
380 flexible from an admin standpoint. We'll go ahead and create two users, a
381 'superuser' that can add other users and administer the db, and a standard user:
382 </p>
383
384 <pre caption="Setting up the superuser">
385 <comment>(replace chris with the username you'd like to use)</comment>
386 $ <i>createuser -a -d -P -E -U postgres -W chris</i>
387 Enter password for new user:
388 Enter it again:
389 Password:
390 CREATE USER
391 </pre>
392
393 <p>
394 There, we've created the superuser. The command line option <c>-a</c> specifies
395 that this user can add other users. <c>-d</c> means that this user can create
396 databases. <c>-P</c> let's you enter a password for the user and <c>-E</c> will
397 encrypt it for security purposes. Now then, we'll test this new user's
398 permissions out by setting up our standard user:
399 </p>
400
401 <pre caption="Setting up the standard user">
402 <comment>(replace chris with the username you've just created)</comment>
403 $ <i>createuser -A -D -P -E -U chris -W testuser</i>
404 Enter password for new user:
405 Enter it again:
406 Password:
407 CREATE USER
408 </pre>
409
410 <p>
411 Success! Our new user was created using the previously created superuser. The
412 <c>-A</c> and <c>-D</c> options do the opposite of <c>-a</c> and <c>-d</c>, and
413 instead deny the user the ability to create other users and databases. Now that
414 there are users to work with, and a new database created, the next chapter will
415 look at using the new database.
416 </p>
417
418 </body>
419 </section>
420 </chapter>
421 <chapter>
422 <title>Using PostgreSQL</title>
423 <section>
424 <title>Setting up permissions</title>
425 <body>
426
427 <p>
428 With the new database created, there is a user that can create databases and
429 add other users, and the main postgres user that can do anything. The user
430 created earlier can currently login to the server, and that's about it. In
431 general, users need to be able to insert data and retrieve data, and sometimes
432 any other number of tasks. So, for this new user to be able to do anything,
433 they must be setup with the proper permissions. This can easily be done by
434 passing the <c>-O</c> parameter to <c>createdb</c>. We'll start by making a
435 new database, <b>MyDB</b> with our superuser that will be owned by the previous
436 testuser:
437 </p>
438
439 <pre caption="Creating the MyDB database">
440 $ <i>createdb -O testuser -U chris -W MyDB</i>
441 Password:
442 CREATE DATABASE
443 </pre>
444
445 <p>
446 Alright, now we have a new MyDB database, and a testuser that can access it.
447 To test this out, we'll login as the testuser to the new MyDB database. We'll
448 do this with the <c>psql</c> program. This program is what's used to connect to
449 the PostgreSQL database from command line. So connect to the new database like
450 so:
451 </p>
452
453 <pre caption="Logging into the MyDB database as the testuser">
454 $ <i>psql -U testuser -W MyDB</i>
455 Password:
456 Welcome to psql 8.0.4, the PostgreSQL interactive terminal.
457
458 Type: \copyright for distribution terms
459 \h for help with SQL commands
460 \? for help with psql commands
461 \g or terminate with semicolon to execute query
462 \q to quit
463
464 MyDB=&gt;
465 </pre>
466
467 <p>
468 So, the testuser is now logged into the database, and can begin to initiate
469 some commands. To get a feel for using PostgreSQL, the next section will take a
470 look at some of the basic commands in navigating the <c>psql</c> client.
471 </p>
472
473 </body>
474 </section>
475 <section>
476 <title>Basic PostgreSQL commands and creating a table</title>
477 <body>
478
479 <p>
480 For those who are used to MySQL, this is somewhat of a definite read. This is
481 where PostgreSQL may get somewhat unique with regards to running commands. To
482 start, here is a list of some commands that will be discussed:
483 </p>
484
485 <table>
486 <tr>
487 <th>Command</th>
488 <th>Usage</th>
489 <th>MySQL Equivalent</th>
490 </tr>
491 <tr>
492 <ti>\c[onnect] [DBNAME|- [USER]]</ti>
493 <ti>Connects to another database</ti>
494 <ti>USE DATABASE</ti>
495 </tr>
496 <tr>
497 <ti>\q</ti>
498 <ti>Quit the <c>psql</c> client</ti>
499 <ti>quit</ti>
500 </tr>
501 <tr>
502 <ti>\i FILE</ti>
503 <ti>Run commands from <c>FILE</c></ti>
504 <ti>source FILE</ti>
505 </tr>
506 <tr>
507 <ti>\o [FILE]</ti>
508 <ti>Send query results to <c>FILE</c></ti>
509 <ti>INTO OUTFILE, but outputs everything (not just SELECTS)</ti>
510 </tr>
511 <tr>
512 <ti>\d [NAME]</ti>
513 <ti>Describe a database or table (as well as other items)</ti>
514 <ti>DESC(RIBE)</ti>
515 </tr>
516 <tr>
517 <ti>\db [PATTERN]</ti>
518 <ti>
519 List available tables that match <c>PATTERN</c> (all if no pattern
520 is given)
521 </ti>
522 <ti>SHOW TABLES</ti>
523 </tr>
524 </table>
525
526 <p>
527 With the exception of <c>\c[onnect]</c>, all the commands shown will be used
528 later on in the section. So right now the database is empty. That said, we need
529 to insert some data. The first step to inserting data, however, is to put it in
530 a table. Right now there are no tables in the database, so we need to create
531 one. This is done with the <c>CREATE TABLE</c> command. We'll make a table of
532 items. They will contain a Product ID, Description, and price:
533 </p>
534
535 <pre caption="Creating the products table">
536 MyDB=> CREATE TABLE products (
537 MyDB(&gt; product_id SERIAL,
538 MyDB(&gt; description TEXT,
539 MyDB(&gt; price DECIMAL
540 MyDB(&gt; );
541 NOTICE: CREATE TABLE will create implicit sequence "products_product_id_seq"
542 for serial column "products.product_id"
543 CREATE TABLE
544 </pre>
545
546 <p>
547 You can ignore the NOTICE, it's perfectly harmless. Looking at the last line of
548 the function, <c>CREATE TABLE</c> seems to indicate that the command has
549 succeeded. However, let's go ahead and verify that the table was indeed
550 successfully created with the <c>\d</c> command:
551 </p>
552
553 <pre caption="Looking at the newly created table">
554 MyDB=&gt; <i>\d products</i>
555 Table "public.products"
556 Column | Type | Modifiers
557 -------------+---------+------------------------------------------------------------------
558 product_id | integer | not null default nextval('public.products_product_id_seq'::text)
559 description | text |
560 price | numeric |
561 </pre>
562
563 <p>
564 Indeed the table was successfully created. Now that the table is created, it
565 needs to be populated with data. The next section will look at populating the
566 database with data.
567 </p>
568
569 </body>
570 </section>
571 <section>
572 <title>Inserting data into the database</title>
573 <body>
574
575 <p>
576 This section will look at the two ways of populating the newly created table
577 with data. First let's look at the most basic command, <c>INSERT</c>:
578 </p>
579
580 <pre caption="INSERT syntax">
581 INSERT INTO [tablename] (column1,column2,column3) VALUES(value1,value2,value3)
582 </pre>
583
584 <p>
585 <c>tablename</c> contains the name of the table to insert the data into.
586 (column1,column2,column3) lets you specify the specific columns to insert the
587 values into. VALUES(value1,value2,value3) is the listing of values. The values
588 are inserted into the same order as the columns (column1 gets value1, column2
589 gets value2, column3 gets value3). These counts <e>must</e> be the same. So
590 let's go ahead and insert an item into the table:
591 </p>
592
593 <impo>
594 From working with databases for a long time, I personally recommend specifying
595 <c>INSERT</c> statements exactly as above. Developers often make the mistake of
596 using <c>INSERT INTO</c> without specifying columns. This is unproductive, as
597 if a new column gets added to the database, it will cause in error if the value
598 to column count is not the same. You should <e>always</e> specify the columns
599 unless you're 300% sure you'll never add a column.
600 </impo>
601
602 <pre caption="Inserting data into the table">
603 MyDB=&gt; <i>INSERT INTO products (description,price) VALUES('A test product', 12.00);</i>
604 INSERT 17273 1
605 </pre>
606
607 <p>
608 The last line needs a bit of explaining. The return of an insert command is an
609 OID (Object Identifier) and the number of rows inserted. OID's are a bit beyond
610 the scope of this guide, and the <uri
611 link="http://www.postgresql.org/docs/8.1/static/datatype-oid.html">PostgreSQL
612 manual</uri> has some good information on it. Now, for a situation where you
613 have 20,000 products, these insert statements can be a little tedious. However,
614 not all is lost. The <c>COPY</c> command can be used to insert data into a
615 table from a file or stdin. In this example, let's assume that you have a csv
616 (comma separated values) file, which contains the product id, description, and
617 price. The file looks like this:
618 </p>
619
620 <pre caption="products.csv">
621 2,meat,6.79
622 3,soup,0.69
623 4,soda,1.79
624 </pre>
625
626 <p>
627 Now we'll use the <c>COPY</c> command to populate our data:
628 </p>
629
630 <impo>
631 The <c>COPY FROM STDIN</c> command is used because only the postgres user can
632 insert data from a file (for obvious security reasons).
633 </impo>
634
635 <pre caption="Using COPY to populate the products table">
636 MyDB=&gt; <i>COPY products FROM STDIN WITH DELIMITER AS ',';</i>
637 Enter data to be copied followed by a newline.
638 End with a backslash and a period on a line by itself.
639 >> <i>2,meat,6.79</i>
640 >> <i>3,soup,0.69</i>
641 >> <i>4,soda,1.79</i>
642 >> <i>\.</i>
643 </pre>
644
645 <p>
646 Unfortunately, this line doesn't return the same status information as the
647 <c>INSERT INTO</c> statement. How do we know the data was inserted? The next
648 section will look at running queries to check our data.
649 </p>
650
651 </body>
652 </section>
653 <section>
654 <title>Using PostgreSQL queries</title>
655 <body>
656
657 <p>
658 This section will look at using the <c>SELECT</c> statement to view data in our
659 tables. The basic <c>SELECT</c> format looks like this:
660 </p>
661
662 <pre caption="SELECT syntax">
663 SELECT (column1,column2|*) FROM (table) [WHERE (conditionals)]
664 </pre>
665
666 <p>
667 There are two ways to select columns. The first is using <c>*</c> to select all
668 columns, and the second is to specify a list of specific columns you wish to
669 see. The second is quite handy when you want to find a specific column in a
670 rather large list of them. Let's start out with using <c>SELECT</c> with
671 <c>*</c> to specify all columns:
672 </p>
673
674 <pre caption="Viewing the products table">
675 MyDB=&gt; <i>SELECT * FROM products;</i>
676 product_id | description | price
677 ------------+----------------+-------
678 1 | A test product | 12.00
679 2 | meat | 6.79
680 3 | soup | 0.69
681 4 | soda | 1.79
682 (4 rows)
683 </pre>
684
685 <p>
686 As shown here, all the data we inserted earlier is indeed in the table. Now
687 let's say we only want to see the description and the price, and don't care
688 about the product id. In this case we'll use the column specific SELECT form:
689 </p>
690
691 <pre caption="Viewing specific columns from the products table">
692 MyDB=&gt; <i>SELECT description,price FROM products;</i>
693 description | price
694 ----------------+-------
695 A test product | 12.00
696 meat | 6.79
697 soup | 0.69
698 soda | 1.79
699 (4 rows)
700 </pre>
701
702 <p>
703 Now only the product and price is shown, letting us focus on only the important
704 data. Now let's say that we want to see only the items that are greater than
705 $2.00. Here's where the <c>WHERE</c> clause comes in handy:
706 </p>
707
708 <pre caption="Viewing specific rows from the products table">
709 MyDB=&gt; <i>SELECT description,price FROM products WHERE price > 2.00;</i>
710 description | price
711 ----------------+-------
712 A test product | 12.00
713 meat | 6.79
714 (2 rows)
715 </pre>
716
717 <p>
718 Now a listing of products over $2.00 is displayed, focusing the data even more.
719 These forms of querying for information are very powerful, and can help create
720 extremely useful reports.
721 </p>
722
723 </body>
724 </section>
725 <section>
726 <title>Conclusion</title>
727 <body>
728
729 <p>
730 This concludes the PostgreSQL Guide. A big thanks goes to Masatomo Nakano, the
731 Gentoo PostgreSQL maintainer for his help in answering my questions. Any
732 suggestions on this guide should be sent to <mail>chriswhite@gentoo.org</mail>.
733 For more extensive documentation, see the <uri
734 link="http://www.postgresql.org">PostgreSQL website</uri>.
735 </p>
736
737 </body>
738 </section>
739 </chapter>
740 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20