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 6989493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:13:08+00:00 2026-05-27T19:13:08+00:00

i have one csv file which contains library group and it’s data… group consider

  • 0

i have one csv file which contains library group and it’s data…

group consider as sheet and for each sheet contains phrase name and phrase value…

I want to insert this csv data to two different table using mysql how can i ?

suppose i have 2 table like

phrase_library_group
+-------------+--------------+------+-----+---------+----------------+
| Field       | Type         | Null | Key | Default | Extra          |
+-------------+--------------+------+-----+---------+----------------+
| GROUP_ID    | bigint(20)   | NO   | PRI | NULL    | auto_increment |
| GROUP_NAME  | varchar(100) | NO   |     | NULL    |                |
| ------------+--------------+------+-----+---------+----------------+

phrase_list
+-------------+--------------+------+-----+---------+----------------+
| Field       | Type         | Null | Key | Default | Extra          |
+-------------+--------------+------+-----+---------+----------------+
| PHRASE_ID   | bigint(20)   | NO   | PRI | NULL    | auto_increment |
| PHRASE_NAME | varchar(100) | NO   |     | NULL    |                |
| PHRASE_DESC | varchar(500) | NO   |     | NULL    |                |
| GROUP_ID    | bigint(20)   | NO   | MUL | NULL    |                |
| ------------+--------------+------+-----+---------+----------------+

here in image Additional_meds/Antibiotic Warnings/… are groups

and each group contains different phrases..like Additional_meds contains total 12 records as see below.

csv like enter image description here

  • 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. Editorial Team
    Editorial Team
    2026-05-27T19:13:09+00:00Added an answer on May 27, 2026 at 7:13 pm

    Do it natively in MySQL, this should be much faster and consume less ressources.
    Create a table in MySQL containing all fields from your CSV, i.e.

    tmp_phrases
    +-------------+--------------+------+-----+---------+----------------+
    | Field       | Type         | Null | Key | Default | Extra          |
    +-------------+--------------+------+-----+---------+----------------+
    | GROUP_NAME  | varchar(100) | NO   |     | NULL    |                |
    | PHRASE_NAME | varchar(100) | NO   |     | NULL    |                |
    | PHRASE_DESC | varchar(500) | NO   |     | NULL    |                |
    | ------------+--------------+------+-----+---------+----------------+
    

    load data from CSV into this table via LOAD INFILE statement inside MySQL, i.e.

    LOAD DATA INFILE '~/phrases.csv' INTO TABLE tmp_phrases FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"';
    

    After that you can split your data with two INSERT statements.

    INSERT INTO phrase_library_group (GROUP_NAME)
        SELECT DISTINCT GROUP_NAME FROM tmp_phrases
    
    INSERT INTO phrase_list (PHRASE_NAME,PHRASE_DESC,GROUP_ID)
        SELECT x.PHRASE_NAME,x.PHRASE_DESC,y.GROUP_ID
        FROM tmp_phrases x
        INNER JOIN phrase_library_group y ON x.GROUP_NAME=y.GROUP_NAME
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a csv file which contains a column named query. One of the
I have a CSV file the first row of which contains the variables names
I have a CSV file the first row of which contains the variables names
I have two .csv files containing correlation matrices exported from R. One file contains
I have unpredictable frequency of Incoming csv data file which I need to store
A csv file contains a '\' character in one of its record for which
I have a CSV file which I am processing and putting the processed data
I have a dataframe in R that I loaded from a CSV file. One
I have a UTF-16 CSV file which I have to read. Python csv module
I have idsfile.csv which is a comma separated file of ids (with no new

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.