Postgresql Loop Through Array Jquery Interview