• 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

    • ...or turn on your selfie camera and, if you're not pasty white, he'll degrade your connection
    • @goretsky I will keep those in mind for the calls we get and update our technicians with the list, im sure the list will grow and I hope there is a larger public statement on this.  Here is the statement from Huntress https://www.huntress.com/blog/klue-breach-investigation    
    • But we are talking about Elon Musk, no AT&T... I know big companies are evil, but Elon and his companies are in another level which is much more dangerous.
    • New PowerToys update fixes memory leaks and other issues by Taras Buria Another bug-fixing update is available for PowerToys version 0.100. After releasing version 0.100.1 with a bunch of bug fixes and patches, Microsoft pushed version 0.100.2 to address two important issues with one of Command Palette Dock's features. With PowerToys 0.100.2, Microsoft fixed the performance meter displaying incorrect values and memory leaks, which are particularly unwanted things in the current situation with overpriced PC hardware. Here is the changelog: Reverted a Performance Monitor dock refresh change that forced item refreshes on every metric update Fixed a memory leak in the Performance Monitor dock extension by reusing stable network upload/download band items instead of creating new list items on each refresh For those unfamiliar, Command Palette Dock is a relatively new addition to PowerToys. It is a taskbar-like tool that you can keep on top of the screen to pin various useful widgets, commands, and more. It can display time, weather, your PC's performance metrics, and more. Microsoft introduced the Command Palette Dock in March 2026 in PowerToys 0.98. Microsoft has dedicated documentation for Command Palette Dock, and you can check it out on the official Microsoft Learn website. You can update PowerToys to the latest version by going to Settings > General and clicking "Check for updates." Alternatively, you can download the installer from GitHub using this link. In other news, Microsoft is working on a new window-management utility for PowerToys. Called Alt Window Cycle, it will let you use the Alt + ` shortcut to switch between different windows in a single app. You can learn more about the tool here.
  • Recent Achievements

    • First Post
      OffsetAbs earned a badge
      First Post
    • Reacting Well
      OffsetAbs earned a badge
      Reacting Well
    • First Post
      Kolakid60 earned a badge
      First Post
    • One Month Later
      xvvxcvv earned a badge
      One Month Later
    • Week One Done
      xvvxcvv earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      422
    2. 2
      +Edouard
      181
    3. 3
      PsYcHoKiLLa
      136
    4. 4
      neufuse
      71
    5. 5
      Steven P.
      71
  • Tell a friend

    Love Neowin? Tell a friend!