Debit Credit Balance calculating from previous records with Pagination
As you have also tagged it with Postgres:

select id, 
       "in", 
       "out", 
       sum("in") over (order by id) - sum("out") over (order by id) as balance
from data
order by id;


The above is not Postgres specific, it's standard ANSI SQL using window functions.

Online example: http://rextester.com/ENBLS73027

To add pagination, use row_number()

select id, "in", "out", balance
from (
  select id, 
         "in", 
         "out", 
         sum("in") over (order by id) - sum("out") over (order by id) as balance, 
         row_Number() over (order by id) as rn
  from data
) t
where rn between 3 and 6 -- rows 3,4,5 and 6
order by id;