Question: Purchases table

```
create table purchase ( 
id integer primary key, 
purchasedate date not null, 
purchasesum numeric(12,2) not null )

```

contains purchase sums. How to find change percent from previos year:

```
select
  extract( year from purchasedate ),
  sum( purchasesum),
  ( sum( purchasesum) - previous row sum( previous purchasesum ) ) /
                previous row sum( previous purchasesum ) * 100
from purchase
group by 1
order by 1

```

Result should be

```
2014     1200
2015     1320    +10%
2016     14784   +12%
2017     1774.08 +20%
2018     1596.67 -10% 
2019     2075.67 +30%

```

Using Postgresql 9.1+

Answer: 
This is how I have managed to install dependencies from private GitHub repositories.

Dependencies in package.json can be added as follows. The `github:` prefix is optional. Specifying the `#branch` or `#tag` is also optional.

```
    "dependencies": {
        ...
        "myrepo": "username/myrepo#master",
        "myotherrepo": "github:username/myotherrepo"
    },

```

Here is an example workflow. `PAT` is a `repo` scoped [Personal Access Token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line). It is important to disable persisted credentials on `actions/checkout`, otherwise they will override your `PAT`. Note that the `git config` change persists between steps so you only need to run it once per job.

```
      - uses: actions/checkout@v2
        with:
          persist-credentials: false
      - uses: actions/setup-node@v1
        with:
          node-version: 12.x
      - run: git config --global url."https://${{ secrets.PAT }}@github.com/".insteadOf ssh://git@github.com/
      - run: npm ci
      ...

```
You should edit your `.npmrc` file.
You can also use `npm config`

`npm config set @myco:registry http://reg.example.com`

Please see the following thread for more information:
[Is there any way to configure multiple registries in a single npmrc file](https://stackoverflow.com/questions/32633678/is-there-any-way-to-configure-multiple-registries-in-a-single-npmrc-file)