excel to mysql

9
Excel to MySQL

Upload: chartio

Post on 13-Jul-2015

118 views

Category:

Data & Analytics


0 download

TRANSCRIPT

Page 1: Excel to MySQL

Excel to MySQL

Page 2: Excel to MySQL

There may be a time when you need to create a table in MySQL and feed it with data, with this data coming from another database or combined data source.

We have created a walkthrough of importing an Excel document to MySQL - so get started today!

For the example we'll be using the an excel file on rental boats.

Excel to MySQL

Page 3: Excel to MySQL

Open your Excel file and click Save As. Choose to save it as a .CSV (Comma Separated) file.

Note that if you are running Excel on a Mac you will need to save the file as a Windows Comma Separated (.csv) or CSV (Windows) to maintain the correct formatting.

Save as a CSV

Page 4: Excel to MySQL
Page 5: Excel to MySQL

Create a database

Log into your MySQL shell and create a database. For this example the database will be named boatdb. Note that the --local-infile option is needed by some versions of MySQL for the data loading we'll do in the following steps.

Page 6: Excel to MySQL

Define the schema

Next we'll define the schema for our boat table using the CREATE TABLE command. For more details you can read the mysql documentation or take what you need from the following example.

Page 7: Excel to MySQL

Verify your table

Run show tables to verify that your table was created

Page 8: Excel to MySQL

Load the data

Now that there is a database and a table setup, the data can be imported with the LOAD DATA command.

Page 9: Excel to MySQL

Visualize it!

If you are a Chartio user you can connect the MySQL database to Chartio and chart away.