Datasets:
File size: 15,982 Bytes
6493056 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | <!DOCTYPE html>
<html data-theme="light" lang="en"><head>
<title>PostgreSQL: Documentation: 18: Part I. Tutorial</title>
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport"/>
<meta content="text/xhtml; charset=utf-8" http-equiv="Content-Type"/>
<meta content="#336791" name="theme-color"/>
<meta content="The PostgreSQL Global Development Group" name="copyright"/>
<meta content="/docs/18/tutorial.html" property="og:url"/>
<meta content="article" property="og:type"/>
<meta content="2026-02-26T14:07:09" property="article:published_time"/>
<meta content="/media/img/about/press/elephant.png" property="og:image"/>
<meta content="Part I. Tutorial" property="og:title"/>
<meta content="Part&nbsp;I.&nbsp;Tutorial Welcome to the PostgreSQL Tutorial. The tutorial is intended to give an introduction to PostgreSQL, relational database concepts, and …" property="og:description"/>
<meta content="PostgreSQL Documentation" property="og:site_name"/>
<link href="/media/css/fontawesome.css?54a05eb2" rel="stylesheet"/>
<link href="/media/css/bootstrap-4.4.1.min.css" rel="stylesheet"/>
<link href="/favicon.ico" rel="shortcut icon"/>
<link href="/dyncss/base.css?54a05eb2" rel="stylesheet" type="text/css"/>
<script src="/media/js/theme.js?54a05eb2"></script>
<link href="/docs/current/tutorial.html" rel="canonical"/>
</head>
<body>
<div class="container-fluid">
<div class="row justify-content-md-center">
<div class="col">
<!-- Header -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand p-0" href="/">
<img alt="PostgreSQL Elephant Logo" class="logo" src="/media/img/about/press/elephant.png"/>
</a>
<input aria-controls="pgNavbar" aria-expanded="false" aria-label="Toggle navigation" id="navbar-toggler" type="checkbox"/>
<label class="navbar-toggler" for="navbar-toggler" id="navbar-toggler-label" tabindex="0"><span class="navbar-toggler-icon"></span></label>
<div class="navbar-collapse" id="pgNavbar">
<ul class="navbar-nav mr-auto">
<li class="nav-item p-2"><a href="/" title="Home">Home</a></li>
<li class="nav-item p-2"><a href="/about/" title="About">About</a></li>
<li class="nav-item p-2"><a href="/download/" title="Download">Download</a></li>
<li class="nav-item p-2"><a href="/docs/" title="Documentation">Documentation</a></li>
<li class="nav-item p-2"><a href="/community/" title="Community">Community</a></li>
<li class="nav-item p-2"><a href="/developer/" title="Developers">Developers</a></li>
<li class="nav-item p-2"><a href="/support/" title="Support">Support</a></li>
<li class="nav-item p-2"><a href="/about/donate/" title="Donate">Donate</a></li>
<li class="nav-item p-2"><a href="/account/" title="Your account">Your account</a></li>
</ul>
<form action="/search/" method="get" role="search">
<div class="input-group">
<input accesskey="s" class="form-control" id="q" maxlength="255" name="q" placeholder="Search for..." size="20" type="text"/>
<span class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="fas fa-search"></i></button>
</span>
</div><!-- /input-group -->
</form>
<form class="form-inline" id="form-theme">
<button class="btn btn-default ml-1" id="btn-theme" type="button"><i class="fas fa-moon"></i></button>
</form>
</div>
</nav>
</div>
</div>
<div class="row justify-content-center pg-shout-box">
<div class="col text-white text-center">February 26, 2026: <a href="/about/news/postgresql-183-179-1613-1517-and-1422-released-3246/">
PostgreSQL 18.3, 17.9, 16.13, 15.17, and 14.22 Released!
</a>
</div>
</div>
</div>
<div class="container-fluid margin">
<div class="row">
<div class="col-11" id="pgContentWrap">
<div class="row">
<div class="col-md-6 mb-2">
<div class="row">
<div class="col">
<div>
<a href="/docs/" title="Documentation">Documentation</a> → <a href="/docs/18/index.html">PostgreSQL 18</a>
</div>
</div>
</div>
<div class="row">
<div class="col">
Supported Versions:
<a class="docs-version-selected" href="/docs/current/tutorial.html" title="PostgreSQL 18 - Part I. Tutorial">Current</a>
(<a class="docs-version-selected" href="/docs/18/tutorial.html" title="PostgreSQL 18 - Part I. Tutorial">18</a>)
/
<a href="/docs/17/tutorial.html" title="PostgreSQL 17 - Part I. Tutorial">17</a>
/
<a href="/docs/16/tutorial.html" title="PostgreSQL 16 - Part I. Tutorial">16</a>
/
<a href="/docs/15/tutorial.html" title="PostgreSQL 15 - Part I. Tutorial">15</a>
/
<a href="/docs/14/tutorial.html" title="PostgreSQL 14 - Part I. Tutorial">14</a>
</div>
</div>
<div class="row">
<div class="col">
Development Versions:
<a href="/docs/devel/tutorial.html" rel="nofollow" title="PostgreSQL devel - Part I. Tutorial">devel</a>
</div>
</div>
<div class="row">
<div class="col-12">
Unsupported versions:
<a href="/docs/13/tutorial.html" rel="nofollow" title="PostgreSQL 13 - Part I. Tutorial">13</a>
/
<a href="/docs/12/tutorial.html" rel="nofollow" title="PostgreSQL 12 - Part I. Tutorial">12</a>
/
<a href="/docs/11/tutorial.html" rel="nofollow" title="PostgreSQL 11 - Part I. Tutorial">11</a>
/
<a href="/docs/10/tutorial.html" rel="nofollow" title="PostgreSQL 10 - Part I. Tutorial">10</a>
/
<a href="/docs/9.6/tutorial.html" rel="nofollow" title="PostgreSQL 9.6 - Part I. Tutorial">9.6</a>
/
<a href="/docs/9.5/tutorial.html" rel="nofollow" title="PostgreSQL 9.5 - Part I. Tutorial">9.5</a>
/
<a href="/docs/9.4/tutorial.html" rel="nofollow" title="PostgreSQL 9.4 - Part I. Tutorial">9.4</a>
/
<a href="/docs/9.3/tutorial.html" rel="nofollow" title="PostgreSQL 9.3 - Part I. Tutorial">9.3</a>
/
<a href="/docs/9.2/tutorial.html" rel="nofollow" title="PostgreSQL 9.2 - Part I. Tutorial">9.2</a>
/
<a href="/docs/9.1/tutorial.html" rel="nofollow" title="PostgreSQL 9.1 - Part I. Tutorial">9.1</a>
/
<a href="/docs/9.0/tutorial.html" rel="nofollow" title="PostgreSQL 9.0 - Part I. Tutorial">9.0</a>
/
<a href="/docs/8.4/tutorial.html" rel="nofollow" title="PostgreSQL 8.4 - Part I. Tutorial">8.4</a>
/
<a href="/docs/8.3/tutorial.html" rel="nofollow" title="PostgreSQL 8.3 - Part I. Tutorial">8.3</a>
/
<a href="/docs/8.2/tutorial.html" rel="nofollow" title="PostgreSQL 8.2 - Part I. Tutorial">8.2</a>
/
<a href="/docs/8.1/tutorial.html" rel="nofollow" title="PostgreSQL 8.1 - Part I. Tutorial">8.1</a>
/
<a href="/docs/8.0/tutorial.html" rel="nofollow" title="PostgreSQL 8.0 - Part I. Tutorial">8.0</a>
/
<a href="/docs/7.4/tutorial.html" rel="nofollow" title="PostgreSQL 7.4 - Part I. Tutorial">7.4</a>
/
<a href="/docs/7.3/tutorial.html" rel="nofollow" title="PostgreSQL 7.3 - Part I. Tutorial">7.3</a>
/
<a href="/docs/7.2/tutorial.html" rel="nofollow" title="PostgreSQL 7.2 - Part I. Tutorial">7.2</a>
/
<a href="/docs/7.1/tutorial.html" rel="nofollow" title="PostgreSQL 7.1 - Part I. Tutorial">7.1</a>
</div>
</div>
</div>
<div class="col-md-6 col-lg-5 offset-lg-1">
<form action="/search/" id="docSearchForm" method="get" role="search">
<input name="u" type="hidden" value="/docs/18/"/>
<div class="input-group">
<input class="form-control" id="q" name="q" placeholder="Search the documentation for..." type="text"/>
<span class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="fas fa-search"></i></button>
</span>
</div><!-- /input-group -->
</form>
</div>
</div>
<div id="docContent">
<div class="navheader">
<table summary="Navigation header" width="100%">
<tbody><tr>
<th align="center" colspan="5">Part I. Tutorial</th>
</tr>
<tr>
<td align="left" width="10%"><a accesskey="p" href="/docs/current/bug-reporting.html" title="5. Bug Reporting Guidelines">Prev</a> </td>
<td align="left" width="10%"><a accesskey="u" href="/docs/current/index.html" title="PostgreSQL 18.3 Documentation">Up</a></td>
<th align="center" width="60%">PostgreSQL 18.3 Documentation</th>
<td align="right" width="10%"><a accesskey="h" href="/docs/current/index.html" title="PostgreSQL 18.3 Documentation">Home</a></td>
<td align="right" width="10%"> <a accesskey="n" href="/docs/current/tutorial-start.html" title="Chapter 1. Getting Started">Next</a></td>
</tr>
</tbody></table>
<hr/>
</div>
<div class="part" id="TUTORIAL">
<div class="titlepage">
<div>
<div>
<h1 class="title">Part I. Tutorial</h1>
</div>
</div>
</div>
<div class="partintro" id="id-1.4.2">
<p>Welcome to the <span class="productname">PostgreSQL</span> Tutorial. The tutorial is intended to give an introduction to <span class="productname">PostgreSQL</span>, relational database concepts, and the SQL language. We assume some general knowledge about how to use computers and no particular Unix or programming experience is required. This tutorial is intended to provide hands-on experience with important aspects of the <span class="productname">PostgreSQL</span> system. It makes no attempt to be a comprehensive treatment of the topics it covers.</p>
<p>After you have successfully completed this tutorial you will want to read the <a class="xref" href="/docs/current/sql.html" title="Part II. The SQL Language">Part II</a> section to gain a better understanding of the SQL language, or <a class="xref" href="/docs/current/client-interfaces.html" title="Part IV. Client Interfaces">Part IV</a> for information about developing applications with <span class="productname">PostgreSQL</span>. Those who provision and manage their own PostgreSQL installation should also read <a class="xref" href="/docs/current/admin.html" title="Part III. Server Administration">Part III</a>.</p>
<div class="toc">
<p><strong>Table of Contents</strong></p>
<dl class="toc">
<dt><span class="chapter"><a href="/docs/current/tutorial-start.html">1. Getting Started</a></span></dt>
<dd>
<dl>
<dt><span class="sect1"><a href="/docs/current/tutorial-install.html">1.1. Installation</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-arch.html">1.2. Architectural Fundamentals</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-createdb.html">1.3. Creating a Database</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-accessdb.html">1.4. Accessing a Database</a></span></dt>
</dl>
</dd>
<dt><span class="chapter"><a href="/docs/current/tutorial-sql.html">2. The <acronym class="acronym">SQL</acronym> Language</a></span></dt>
<dd>
<dl>
<dt><span class="sect1"><a href="/docs/current/tutorial-sql-intro.html">2.1. Introduction</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-concepts.html">2.2. Concepts</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-table.html">2.3. Creating a New Table</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-populate.html">2.4. Populating a Table With Rows</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-select.html">2.5. Querying a Table</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-join.html">2.6. Joins Between Tables</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-agg.html">2.7. Aggregate Functions</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-update.html">2.8. Updates</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-delete.html">2.9. Deletions</a></span></dt>
</dl>
</dd>
<dt><span class="chapter"><a href="/docs/current/tutorial-advanced.html">3. Advanced Features</a></span></dt>
<dd>
<dl>
<dt><span class="sect1"><a href="/docs/current/tutorial-advanced-intro.html">3.1. Introduction</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-views.html">3.2. Views</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-fk.html">3.3. Foreign Keys</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-transactions.html">3.4. Transactions</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-window.html">3.5. Window Functions</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-inheritance.html">3.6. Inheritance</a></span></dt>
<dt><span class="sect1"><a href="/docs/current/tutorial-conclusion.html">3.7. Conclusion</a></span></dt>
</dl>
</dd>
</dl>
</div>
</div>
</div>
<div class="navfooter">
<hr/>
<table summary="Navigation footer" width="100%">
<tbody><tr>
<td align="left" width="40%"><a accesskey="p" href="/docs/current/bug-reporting.html" title="5. Bug Reporting Guidelines">Prev</a> </td>
<td align="center" width="20%"><a accesskey="u" href="/docs/current/index.html" title="PostgreSQL 18.3 Documentation">Up</a></td>
<td align="right" width="40%"> <a accesskey="n" href="/docs/current/tutorial-start.html" title="Chapter 1. Getting Started">Next</a></td>
</tr>
<tr>
<td align="left" valign="top" width="40%">5. Bug Reporting Guidelines </td>
<td align="center" width="20%"><a accesskey="h" href="/docs/current/index.html" title="PostgreSQL 18.3 Documentation">Home</a></td>
<td align="right" valign="top" width="40%"> Chapter 1. Getting Started</td>
</tr>
</tbody></table>
</div>
</div>
<div id="docComments">
<h2>Submit correction</h2>
<p>
If you see anything in the documentation that is not correct, does not match
your experience with the particular feature or requires further clarification,
please use
<a href="/account/comments/new/18/tutorial.html/" rel="nofollow">this form</a>
to report a documentation issue.
</p>
</div>
</div> <!-- pgContentWrap -->
</div>
</div>
<!-- Footer -->
<footer id="footer">
<!-- Copyright -->
<div class="container">
<a href="/about/policies/">Policies</a> |
<a href="/about/policies/coc/">Code of Conduct</a> |
<a href="/about/">About PostgreSQL</a> |
<a href="/about/contact/">Contact</a><br/>
<p>Copyright © 1996-2026 The PostgreSQL Global Development Group</p>
</div>
</footer>
<script src="/media/js/main.js?54a05eb2"></script>
</body></html> |