Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 147627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:48:52+00:00 2026-05-11T08:48:52+00:00

I have a text file with a long list of terms (approx 800) sorted

  • 0

I have a text file with a long list of terms (approx 800) sorted alphabetically in the format:

 aword bword cword ... 

I would like to use this file to create a new MySQL table where each term is a field, all with the property VARCHAR(5).

Would be best if the fields were inserted in the order in which they appear in the file as I also use this file in scripts for content analysis and it would be easier if the (alphabetical) order was maintained when it came time to insert data into this new table.

For those curious, I am a student doing a thesis project in the history of science that involves content analysis. The fields will be used to hold frequency data. There will be another field that will the primary key and link these fields with other data. I am no programmer, but do have 10 years experience running linux and am usually able to figure things out. However, Google has failed me here.

EDIT

So Damoviso pointed out that what I really needed to do was turn the file into a mySQL command. I used awk and uniq to generate the following:

CREATE TABLE keyterms_frq (     filename VARCHAR(20),     apperception VARCHAR(5),     behaviorism VARCHAR(5),     behavioristic VARCHAR(5),     behaviorists VARCHAR(5),     behaviorist VARCHAR(5),     behavior VARCHAR(5),     behaviour VARCHAR(5),     brain VARCHAR(5),     conditioned VARCHAR(5),     conditioning VARCHAR(5),     condition VARCHAR(5),     consciousness VARCHAR(5),     conscious VARCHAR(5),     experienced VARCHAR(5),     experiences VARCHAR(5),     experience VARCHAR(5),     intellect VARCHAR(5),     introspections VARCHAR(5),     introspection VARCHAR(5),     introspectively VARCHAR(5),     introspective VARCHAR(5),     intuition VARCHAR(5),     memoryimage VARCHAR(5),     memory VARCHAR(5),     mentality VARCHAR(5),     mentally VARCHAR(5),     mental VARCHAR(5),     mind VARCHAR(5),     mirrorscript VARCHAR(5),     mirrorwriting VARCHAR(5),     unconditioned VARCHAR(5) );   

Which is unfortunately still not working, as it generates the following:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘condition VARCHAR(5), consciousness VARCHAR(5), conscious VARCHAR(5), experience’ at line 1

I initially thought there was a limit to how many fields I could generate, but that doesn’t seem to be the issue

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:48:53+00:00Added an answer on May 11, 2026 at 8:48 am

    Personally (and I know this probably won’t be popular), but I tend to use Excel and something like Textpad or Notepad++ (or even vanilla Notepad) for once-off database inserts and table creations like this.

    Import the text file so you have each word in a new row, sort them as required, and build the SQL commmand around it by inserting columns and a row at the top and bottom.

    In this case, I’d suggest:

    1. Insert a row at the top with the following contents in cell A1:
      CREATE TABLE MyTable (Id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    2. In each cell in column B that’s next to a word, put the following contents:
      VARCHAR(5),
    3. Remove the comma for the last one and put a ‘);‘ in the cell below.
    4. Save as a tab-delimited file, then using the text editor of your choice, replace tabs with spaces.

    You’ll be left with a SQL file you can run against the database.

    Yes, it’s messy and not very 1337, but it’s effective.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 62k
  • Answers 62k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Depending on your exact problem, this could be more complicated… May 11, 2026 at 10:07 am
  • added an answer Allow your application to respond to some url (eg: myapp://launch… May 11, 2026 at 10:07 am
  • added an answer You could use your own bundle context as an entry… May 11, 2026 at 10:07 am

Related Questions

I have a text file with dos elements - hex(00) for example. I need
Suppose I have a text file with data separated by whitespace into columns. I
I have a skeleton text file with placeholder strings: blah blah blah blah $PLACEHOLDER_1$
If I have an NSString with a text file in it, how do I
I have to parse a tab-delimited text file with Ruby to extract some data
I am reading a text file with this format: grrr,some text,45.4321,54.22134 I just have
I have a text file on my local machine that is generated by a
I have a text file of this format: L O A D C A
I have a text file in the root of my web app http://localhost/foo.txt and
I have a text file where I want to change only the first line

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.