finalized DAO & script sql