This page in other versions: 9.0 / 9.1 / 9.2 / 9.3 / 9.4  |  Development versions: devel  |  Unsupported versions: 7.2 / 7.3 / 7.4 / 8.0 / 8.1 / 8.2 / 8.3 / 8.4

Chapter 2. The SQL Language

2.1. Introduction

This chapter provides an overview of how to use SQL to perform simple operations. This tutorial is only intended to give you an introduction and is in no way a complete tutorial on SQL. Numerous books have been written on SQL, including Understanding the New SQL and A Guide to the SQL Standard. You should be aware that some PostgreSQL language features are extensions to the standard.

In the examples that follow, we assume that you have created a database named mydb, as described in the previous chapter, and have started psql.

Examples in this manual can also be found in the PostgreSQL source distribution in the directory src/tutorial/. Refer to the README file in that directory for how to use them. To start the tutorial, do the following:

$ cd ..../src/tutorial
$ psql -s mydb

mydb=> \i basics.sql

The \i command reads in commands 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 file basics.sql.


Dec. 21, 2002, 12:15 a.m.

The filename is what they say, but you have to perform a make (gmake) in that directory. Please be sure to use gnu make, that makefile dosn't appear to test for the correct make, it just displays a bunch of errors. On openBSD anyway, I had to install gnu make to install postgresql at all, so I have two different versions, and the incorrect one is not in the normal path.

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group