Postgres Workshop
Objectives
Become familiar with SQL commands to:
- create new databases
- create tables in a database
- add rows
- retrieve data from existing databases
- alter tables (e.g. add columns)
- run the above on your machine
Practice SQL commands
Practice SQL commands going through the following sections of this tutorial (you can do more if you like, of course):
Create and update a database
Except from 1. and 2. you will find out all the commands you need on your own (in pairs)!
- on your command-line open the postgreSQL (psql) shell -
psql
orpsql postgres
. - create a new database with
create database database_name
. If you getERROR: permission denied to create database
, exit the shell and start a terminal session as user "postgres" (sudo -su postgres
) and open psql. - Create a table with naming of your choice.
- Play with SQL commands in order to:
- Query the table by specific parameters
- Alter the values of existing cells of your table
- Alter data types
- Add columns
- Combine operations
- etc. surprise us!
Resources
- PG Databases management (includes creation)
- PG Queries
- SQL tutorial`