Postgres by Example

thenewedrock1 pts0 comments

GitHub - boringcollege/postgres-by-example: Yet another postgresql book! · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

boringcollege

postgres-by-example

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star<br>56

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>1 Commit<br>1 Commit

lessons

lessons

source

source

.gitignore

.gitignore

CONTRIBUTING.md

CONTRIBUTING.md

LICENSE

LICENSE

README.md

README.md

View all files

Repository files navigation

Postgres by Example

PostgreSQL is a powerful, open-source relational database. Please read the official documentation to learn more.

Postgres by Example is a hands-on introduction to PostgreSQL using annotated SQL examples. Check out the first example or browse the full list below.

Prerequisites: PostgreSQL installed and the server running. Examples assume you can connect with psql; the default database is postgres unless noted. Start the server with your system's service manager or pg_ctl start as needed.

Unless stated otherwise, examples target current stable PostgreSQL. Use the latest version you can if something isn't working.

Table of Contents

Getting Started

First Query

psql Basics

Querying

SELECT Basics

WHERE

ORDER BY

SELECT from a Table

LIMIT and OFFSET

DISTINCT

NULLs

Expressions

Data Types

Numeric Types

Text Types

Boolean and Dates

UUID and JSONB

DDL

CREATE TABLE

Column Types and Constraints

ALTER TABLE and DROP

Primary Keys and Unique

NOT NULL and DEFAULT

DML

INSERT

UPDATE

DELETE

RETURNING

Joins and Sets

INNER and LEFT JOIN

RIGHT and FULL JOIN

Self-Join

UNION, INTERSECT, EXCEPT

Aggregation and Grouping

COUNT, SUM, AVG

GROUP BY

HAVING

Subqueries

Scalar and IN Subqueries

EXISTS and Derived Tables

Functions and Operators

String and Numeric Functions

Date Functions and COALESCE

CASE

Indexes

CREATE INDEX

When to Index

Transactions

BEGIN, COMMIT, ROLLBACK

Savepoints

Views

CREATE VIEW

Security

Roles and GRANT

Extras

psql Meta-commands

COPY

Licensed under CC BY 4.0.

by Dariush Abbasi | source

About

Yet another postgresql book!

Topics

postgres

book

postgresql

postgis

postgresql-database

postgres-book

Resources

Readme

License

View license

Contributing

Contributing

Uh oh!

There was an error while loading. Please reload this page.

Activity

Custom properties

Stars

56<br>stars

Watchers

watching

Forks

forks

Report repository

Releases

No releases published

Packages

Uh oh!

There was an error while loading. Please reload this page.

Contributors

Uh oh!

There was an error while loading. Please reload this page.

Languages

PLpgSQL<br>100.0%

You can’t perform that action at this time.

postgres postgresql example reload commit another

Related Articles