Convert CSV file to SQL Update

convert csv to sql is a tool that lets you convert a CSV file and generate equivalent SQL

Example:

/* Student Table */

student_id    First_Name   Last_name          Fav_sports
1                     Aralia          elata                    Basketball
2                   Cornus         alternifolia       BasketBall
3                  Davidia         involucrata     Football

/* CSV File – We want to update Fav_sports based on student_id */

student_id, Fav_sports
1,VolleyBall
2,VolleyBall
3,Soccer

 

/* Ouput for update stetement */

UPDATE Student_tbl SET Fav_sports = ‘VolleyBall’ WHERE student_id = ‘1’;
UPDATE Student_tbl SET Fav_sports = ‘VolleyBall’ WHERE student_id = ‘2’;
UPDATE Student_tbl SET Fav_sports = ‘Soccer’ WHERE student_id = ‘3’;

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*