2.1. Introduction

|    2.1. Introduction    |                       |                           |                  |                               |
|:-----------------------:|-----------------------|---------------------------|------------------|-------------------------------|
|[Prev](tutorial-sql.html)|[Up](tutorial-sql.html)|Chapter 2. The SQL Language|[Home](index.html)| [Next](tutorial-concepts.html)|

---

## 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 [[melt93]](biblio.html#MELT93) and [[date97]](biblio.html#DATE97). 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 been able to start psql.

 Examples in this manual can also be found in the PostgreSQL source distribution in the directory `src/tutorial/`. (Binary distributions of PostgreSQL might not provide those files.) To use those files, first change to that directory and run make:

```
$ cd .../src/tutorial
$ make

```

 This creates the scripts and compiles the C files containing user-defined functions and types. Then, to start the tutorial, do the following:

```
$ psql -s mydb

...

mydb=> \i basics.sql

```

 The `\i` command reads in commands from the 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`.

---

| [Prev](tutorial-sql.html) |[Up](tutorial-sql.html)| [Next](tutorial-concepts.html)|
|:--------------------------|:---------------------:|------------------------------:|
|Chapter 2. The SQL Language|  [Home](index.html)   |         2.2. Concepts         |

 // \<![CDATA[ \<-- For SVG support if ('WebSocket' in window) { (function() { function refreshCSS() { var sheets = [].slice.call(document.getElementsByTagName("link")); var head = document.getElementsByTagName("head")[0]; for (var i = 0; i \< sheets.length; ++i) { var elem = sheets[i]; head.removeChild(elem); var rel = elem.rel; if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") { var url = elem.href.replace(/(&|\\?)\_cacheOverride=\\d+/, ''); elem.href = url + (url.indexOf('?') \>= 0 ? '&' : '?') + '\_cacheOverride=' + (new Date().valueOf()); } head.appendChild(elem); } } var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://'; var address = protocol + window.location.host + window.location.pathname + '/ws'; var socket = new WebSocket(address); socket.onmessage = function(msg) { if (msg.data == 'reload') window.location.reload(); else if (msg.data == 'refreshcss') refreshCSS(); }; console.log('Live reload enabled.'); })(); } // ]]\>