finish sql