add scripts for counting using sql