Checks if table exists before trying to execute the statements