working on sql script for mysql