correct sql and header for table