SQL scripts for various tasks