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’;

 

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s