Fix SQL design