Howdy, I have a bit of a question for you all. I’m wanting to import a .csv file into a MySQL database, but I’m not sure how I’d go about formatting it to match the table structure.
A few sample lines from the .CSV (almost 5k lines in total):
LABNAME,COMPUTERNAME,USERNAME,TIME,DATE
"firstfloor", D37A5GG1, hatleyad, 13:40:53.98, 07/09/2010
"lab118A", LKLCKB8, curries, 13:42:22.15, 07/09/2010
"firstfloor", D96A5GG1, johnso62, 13:44:06.95, 07/09/2010
"firstfloor", D96A5GG1, biggers, 14:04:43.83, 07/09/2010
"secondfloor", D5I92VFI, lockhabe, 14:06:16.85, 07/09/2010
"firstfloor", DDM0VLJ1, james11, 14:24:51.42, 07/09/2010
"firstfloor", D67A5GG1, holdridg, 14:35:50.57, 07/09/2010
"secondfloor", DHI92VF1, martinn, 14:38:34.41, 07/09/2010
"firstfloor", DB7A5GG1, girtyl, 14:42:00.95, 07/09/2010
"firstfloor", D4M0VLJ1, xiong03, 14:51:07.98, 07/09/2010
"lab118A", LKLOAG1, winlock, 14:57:13.70, 07/09/2010
My two issues:
- I need to strip the LABNAME column of quotes
- I need to format the date and time columns to match the standard syntax for MySQL (I’m just using the data types DATE and TIME for each column at the moment).
Is there a simple way to do this, or am I going to have to format the .CSV before importing? If I do have to format it beforehand, what would be the quickest way to do so? This will just be a one-time conversion, just getting everything online.