Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie needs help importing (or appending) csv file to table 1

Status
Not open for further replies.

lexus

MIS
Oct 1, 1998
277
I am a total newbie to MySQL and probably have taken on too large of a project but it seems straightforward and simple. I am trying to learn it on my own, from websites, books, etc.

So I need someone to explain how I can do the following. I mean, explain like you are writing a page in the "Dummies" book. I can't find the answer anyplace!

I have a table called information in the employee database. It has 6 fields or columns. I started entering the information through phpMyAdmin.

It seems easier to do it in Excel, save it as a *.csv file, and tehm load the data into the table. I did this with another table through the MySQL Monitor and it worked great.

Now that I have done 15 rows in the table thru phpMyAdmin,how can I bring the information.csv file into the information table? Is there an append or insert into command? I can find where I can bring in single lines but not from a *.csv file.

If there is, can someone please help me? I could delete the rows I already have but would be much happier if I could append the new file to the information I already have in there.

If there is a way, could you please type it out for me? Or point me to a place where I can get the information? It's so hard to look if you don't know the exact term, such as LOAD DATA, etc.

Also, is it case-sensitive? Is LOAD DATA the same as load data?

I am sorry for asking questions that are probably so basic but I have been searching for the answers for several days! This is a project I am trying to do on my own and I am looking for some classes that don't go into the technical server setup but just the how to make it work end.

Thanks for all your help!

Regards....

**Quiquid latine dictum sit altum viditur.**
 
MySQL clauses are not case-sensitive. [tt]LOAD DATA[/tt] is the same as [tt]load data[/tt].

The canonical place for information on MySQL is MySQL's developer support site. There you will find a complete reference on MySQL.

Were I loading data from a CSV into a MySQL table, I would use the LOAD DATA command. ( The easiest way to use the command is to make sure the CSV is on the filesystem of the server somewhere, and do NOT use the [tt]LOCAL[/tt] clause.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Thanks, Sleipnir. I think you've answered some questions for me in another forum.

But when I do the load data, will that overwrite what I already have in the table or append it at the bottom of the table as new rows?

I am also doing all of this locally on my laptop as a testing server.

**Quiquid latine dictum sit altum viditur.**
 
A LOAD DATA query will add more rows to the table.

Although when you're talking about a relational database, concepts like "bottom" are meaningless. A relational database table is a mathematical set, and imposes no order on the records. It is only when you use an ORDER BY clause in a SELECT query that records may have an order.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Sleipnir, you are wonderful! You are great dealing with my newbie terminology and I thank you for your patience and clear explanations. So I can use the LOAD DATA and add MORE rows and not overwrite the other data.

Thanks! You're the best :)

**Quiquid latine dictum sit altum viditur.**
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top