Exploring the database
Now that you have created a database cluster and connected to it, you can start exploring the database. In this step, we'll show you how to use psql
to connect to the database cluster and run some basic queries.
Assuming that you are using psql
as your Postgres client as suggested in the previous step, proceed to connect to the database cluster.
Once you have connected you can run some basic queries. But first you'll want to create a database of your own to work with.
Create a database
Create a user with the edb_admin role:
Create a database:
Grant the user access to the database:
Connect to the database:
Create a table and data
Let's create a table of integers and populate it with some random values.
Create a table:
Populate the table:
Run some queries
- Get a sum of the value column (and a count of the rows):
- Get the average value:
- Get the maximum value:
- Get the minimum value:
- Get the standard deviation of the values:
- Get the ten lowest values in the table:
- Get the ten highest values in the table:
Could this page be better? Report a problem or suggest an addition!