Copied Daniels code as i am trying to understand psql