Updated data access layer with actual SQL queries for Posts.