This chapter provides an overview of how to perform simple operations using SQL. The purpose of this tutorial is simply to give you an introduction, not a complete SQL tutorial. There are many books on SQL, including understanding the New SQL and A Guide to the SQL standard. And you know some of the PostgreSQL language features are extensions to the standard.
In the following example, we assume that you have created a database named MyDB , as described in the previous chapter, and have started the psql.
Examples of this manual can also be found in the src/tutorial/ of the PostgreSQL source code release directory. To use these files, first enter the directory and then run make :
$..../src/tutorial$make
This creates the scripts and compiles a C file that contains user-defined functions and types. If you are installing a pre-packaged (not compiled from source) version, the "Make" section should already be done for you, please refer to the Tutorial directory in the documentation. To start this tutorial, proceed as follows:
$..../tutorial$psql -s mydb...mydb=>\i basics.sql
The \i command reads the command from the specified file. The- 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 basics.sql file.
For more information on PostgreSQL, please refer to http://www.infocool.net/
2.1 PostgreSQL SQL Language Introduction