sql script corrected 2 and tested