wrote, tested SQL and data code