Organizing SQL script for Corktiles