modularized sql creation