add sql query to create occurence table