Sign in to follow this  

converting Text file into table in MySQL

Recommended Posts

ramesh0123    0

I have a folder that contains 50 text files ,i require a program that can read these text files and convert them into tables,i want the primary key to be the name of the text file.

//sample contents of my 1.txt file is as follows

atro

astrology

king

moon

monkey

seven

skin

All the text file contain the information in the same format

Share this post


Link to post
Share on other sites
Kami-    178

I have a folder that contains 50 text files ,i require a program that can read these text files and convert them into tables,i want the primary key to be the name of the text file.

<snip>

All the text file contain the information in the same format

So you want 50 files converting into 50 tables, with a primary key bein the name of the file? eh? *headsplodes*

  • Like 1

Share this post


Link to post
Share on other sites
Kalint    228

red rum... Red Rum... RED RUM... RED RUM! RED RUM! RED RUM! RED RUM!

Share this post


Link to post
Share on other sites
Haggis    983

yeah i am lost too

If you had one table with the text files name as the primary key

but if you had a table for each text file the primary key could not be the name of the text file as the primary key has to be unique

Share this post


Link to post
Share on other sites
tim_s    42

Using a VARCHAR as a primary key would be a bad idea.

Share this post


Link to post
Share on other sites
Kami-    178

I call TROLL!

Share this post


Link to post
Share on other sites
+Andre S.    1,892

So you require someone to do your homework? Good luck with that.

Share this post


Link to post
Share on other sites
tim_s    42

Create the table + bash = 10 minutes top but why would you do this?

Share this post


Link to post
Share on other sites
Kalint    228

So you require someone to do your homework? Good luck with that.

I wouldn't believe a teacher would assign such a weird assignment like this.

Share this post


Link to post
Share on other sites
Hardcore Til I Die    286

The primary key has to be UNIQUE as it is what is used to reference a record in a table.

So if your file (1.txt) contained:

atro

astrology

king

moon

monkey

seven

skin

Then your table would not be able to use the file name as the primary key for each of those records because the file name doesn't change; it will always be 1.txt. Each of those seven records must have a unique primary key.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.