Postgres Get Number From String Sql Query Examples With Multiple Tables