Csv

Load CSV files into the database

Recently, I wanted to display the places of residence of the members of my club on a map for a personal gimmick (IGOC members). I knew the addresses of the club members. But not the coordinates of their places of residence.

So I went in search of the coordinates and found what I was looking for at the Federal Office of Topography (swisstopo).

The data is available there as a CSV file. Details here: Swiss town coordinates.

How do I load this data into a database?

Loading the data with MariaDB/MySQL

MariaDB …

The MySQL CSV Storage Engine

A little summary about the MySQL CSV table engine:

  • The SQL-Demo script (930 byte) for the following article.
  • The CSV converter to convert normal CSV files into a CSV format which is for MySQL acceptable.

Caution: Use on your own risk!

MySQL CSV tables (internally also called TINA tables) are driven by the MySQL CSV storage engine. This feature was added in MySQL release 4.1.4. CSV tables store data in text files using the Character-Separated-Value format.

mysql> SELECT version();
+------------+
| …
Subscribe to RSS - Csv