Home > Database > Mysql Tutorial > body text

How can I import a CSV file into an existing database table using phpMyAdmin?

Barbara Streisand
Release: 2024-10-25 03:46:29
Original
140 people have browsed it

How can I import a CSV file into an existing database table using phpMyAdmin?

Importing a CSV into phpMyAdmin

You've got a CSV file with data structured like this:

candidate_id,show_on_site,first_name,surname,gender,DOB,showdob,Location,height,eyes,hair_colour,hair_length,accents,unions,training,url,visible,availability
,26,urban talent,Strawberry,Shortcake,Female,11 Jan 1942,FALSE,Manchester,5'2,Brown,Black,Mid-length,Native Lancashire,Equity,Urban Talent TV & Drama Workshops,Strawberry-Shortcake---5.4.06.jpg,Yes,Yes
,29,urban talent,Rainbow,Brite,Female,12 Oct 1970,FALSE,Manchester,5'7,Brown,Dark Brown,Long,"Native Manchester, others include - Cheshire, RP, Patois, Standard USA",Equity Member,"BA Acting Studies, Arden School of Theatre<br>Urban Talent TV &amp; Drama Workshops",Rainbow Brite 1_1.jpg,Yes,Yes
Copy after login

And you want to import it into an existing database table, rather than creating a new one.

Solution in phpMyAdmin

  1. In phpMyAdmin, select the target table.
  2. Click the "Import" tab.
  3. Browse and open your CSV file.
  4. Leave the "Character set" as default.
  5. Uncheck "Partial import" (unless you have a huge dataset).
  6. Set the following four fields:

    • Fields terminated by: ,
    • Fields enclosed by: "
    • Fields escaped by:
    • Lines terminated by: auto
  7. If you want to overwrite existing data, check "Replace table data with file".
  8. Optionally, check "Ignore duplicate rows".
  9. Click "Go".

The data from your CSV file will be successfully imported into the existing table.

The above is the detailed content of How can I import a CSV file into an existing database table using phpMyAdmin?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!