How to Turn SQL Into Reusable APIs