The first thing you'll want to do after setting up MySQL, it's
My web host has a method for creating a database with nothing in it. A
start perhaps but what use is a database without data ?
Well, you might as well ask what the point of creating an Access
database is if it doesn't come with your data already in it. The answer
is that you have to create an empty database first (CREATE DATABASE),
set up the table structures (CREATE TABLE), and then populate the
database with data (LOAD DATA). These are three distinct, logical stages.
So, your first step is to think of the name of a database. Let's call it
JohnsDb for the sake of argument. The command you'll want to issue is:
CREATE DATABASE JohnsDb
Now, look at your CSV file. It will have columns. Think of a name for
those columns, and a type. I don't know what the structure of your CSV
file, so let me take the example of the CSV file being information about
friends. Suppose the CSV file contains columns for firstname, surname,
and height. Well, their names will be strings, and their height will be
floats. Strings are declared using VARCHAR. You have to decide how many
characters you'll allow for the names. Let's say 20 characters apiece.
So, to create the table, you'll need to issue a command like:
CREATE TABLE friends (firstname VARCHAR(20), surname VARCHAR(20), height
FLOAT)
SQL syntax can vary a bit from db app to db app, so someone should
correct me if I'm wrong. There may need to be a PRIMARY KEY inserted in
the above statement.
My own webpage contains some trimmed-down examples of commands that can
be issued:
http://www.markcarter.me.uk/computing/sql/sql.html
Again, they're not necessarily valid for all db apps, but they should at
least point you in the right direction without you having to decipher
BNF (Bachus Naur Form) (a way of specifying language grammars).