SQL test code