new sql scripts for all studies page