• 0

converting Text file into table in MySQL


Question

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

9 answers to this question

Recommended Posts

  • 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.

<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*

  • 0

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

  • 0

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.

This topic is now closed to further replies.
  • Posts

    • Salesforce to acquire Fin, formerly Intercom, for over $3 billion by David Uzondu Image via DepositPhotos.com Salesforce today announced that it has reached an agreement with customer support software company Fin to buy the company for around $3.6 billion. Salesforce expects the transaction to close in the fourth quarter of its fiscal year 2027, and the acquisition will not change its financial guidance previously announced on May 27. Marc Benioff, CEO of Salesforce, in its press release, claimed that acquiring the startup gives Salesforce an immediate AI agent that resolves support tickets across email, WhatsApp, SMS, and Slack: You might know Fin by its former name, Intercom. If you have ever been on a website or inside a mobile app and noticed a little chat bubble widget floating in the bottom right corner of your screen, often featuring a friendly face and a message like, "Hi! How can we help you today?" you were almost certainly looking at Intercom. Intercom became Fin just last month, transforming itself into an "AI-first" platform that handles customer issues with little need for humans to intervene. The new name originates from the company's highly successful AI customer service agent, which it launched way back in 2023. This digital assistant supposedly resolves about 76% of customer service volume end-to-end on its own, so the business rebranded to match its primary software tool. Fin's new owners, Salesforce, went on an acquisition spree over the last few years, and some of them you might recognize, like its 2020 $27.7 Billion acquisition of Slack. The last few months saw the enterprise giant buy several startups, including m3ter, Momentum, Cimulate, and Contentful. Salesforce said that when the Fin deal pulls through, customers will "deploy AI agents across" various service operations, which will complement Agentforce, the platform that enables businesses to deploy customizable autonomous digital workers.
  • Recent Achievements

    • Week One Done
      Jeroen Wilms earned a badge
      Week One Done
    • Week One Done
      rolfus earned a badge
      Week One Done
    • One Month Later
      Leroy Jethro Gibbs earned a badge
      One Month Later
    • Conversation Starter
      flexorcist earned a badge
      Conversation Starter
    • One Month Later
      AndreaB earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      503
    2. 2
      +Edouard
      201
    3. 3
      PsYcHoKiLLa
      127
    4. 4
      Steven P.
      82
    5. 5
      ATLien_0
      76
  • Tell a friend

    Love Neowin? Tell a friend!