To use this, place the docker-compose.yaml
file in a new directory.
Then run:
docker-compose up
Once up, you can access http://localhost:8080 to administrate the db. Login with: postgres/example
Or run this from another terminal for command line access:
docker-compose exec db bash
Then run this to connect using the command line:
psql -h localhost -U postgres
postgres=# select percentile_cont(.20) within group (order by height) from height;
percentile_cont
-----------------
136
(1 row)
postgres=# select percentile_disc(.20) within group (order by height) from height;
percentile_disc
-----------------
120
(1 row)
postgres=# select height, NTILE(5) over (order by height) from height;
height | ntile
--------+-------
120 | 1
140 | 2
160 | 3
170 | 4
172 | 5
(5 rows)
postgres=# select height, NTILE(2) over (order by height) from height;
height | ntile
--------+-------
120 | 1
140 | 1
160 | 1
170 | 2
172 | 2
(5 rows)