updated SQL query
completed app