Create sql plan