Transform data  to sql