Fixed SQL Queries and added db script