EAN-130000000000123   EAN-13 barcode 0000000000123
UPC-A000000000123   UPC-A barcode 000000000123
UPC-E00001203   UPC-E barcode 00001203
Product NameAccent Furniture - Wyndham Ck Poster Bed - Ha848435-45-55
CategoryElectronics / Photography
Amazon.comA Buy on Amazon ~ B001I6SFUC
BindingElectronics
Long DescriptionAccent Furniture - Wyndham CK Poster Bed - HA848435-45-55 1 x Headboard (78"Wx85"Hx4"D) 1 x Footboard (78"Wx85"Hx4"D) 1 x Siderails (86"Wx7"Hx1"D) Weight: Approx 235 lbs. Constructed of cherry veneer solids and MDF. Cherry finish.
Created01-08-2013 6:02:35am
Modified05-26-2017 10:56:16am
MD5c8a32871d5aa671813d0bdd7bec7cf29
SHA256f3bcc3c279bc61c9c84413c88e4244255fe7ecc80fe7d52a054cc586df854ecf
Search Googleby EAN or by Title
Query Time0.0008101

Here we will demonstrate the most basic example of importing the CSV data files that we produce on this site into your MySQL database.

For information about various databases you can use and how to import CSV files into them, please view the overview article "Importing CSV data into your database".

For this example, we are going to import the product data CSV file out of the sample_ean_data.zip but this same process will work on the full data download file. We will also be executing the commands in the MySQL Workbench but you can also use the command line tool with the same commands if you like.

First, start by creating a blank table. Use the table layout described in the read_me file for the most up-to-date table layout. It is suggested that you not use any indexing at this point. You can add indexes later. It is most likely that you will have your own tables where you want to store your data so importing the CSV files can be done into temporary tables and then later copied over to your tables. Leaving off the indexes and constraints on these import tables reduces the risk of import errors. Here is an example:

create table ean_product
(
    EAN13             varchar(13),
    UPCA              varchar(12),
    UPCE              varchar(8),
    SKU               varchar(200),
    PriceNew          numeric(15,2),
    PriceUsed         numeric(15,2),
    PriceDate         date,
    company           varchar(13),
    product           varchar(100),
    description       varchar(100),
    category          int,
    url               varchar(500),
    created           datetime,
    modified          datetime
);

Next we perform the import using the LOAD DATA INFILE command. The path to the file depends on where you saved the data and which operating system you are on. For Windows users you might find your file on the C: drive and Linux users may find your date in your home (~) folder. This example shows a Linux import. Only the path would be different between the operating systems.

LOAD DATA LOCAL
    INFILE '~/sample_ean_data/sample_ean_product.csv' 
    INTO TABLE ean_product
    FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '\\'
    LINES TERMINATED BY '\r\n'
    IGNORE 1 LINES;

Finally, lets look at the data that we just imported.

SELECT * FROM EAN_PRODUCT;

You may have seen some warnings after the import command. If you are concerned about these warnings, examine the data. It could be that some data has grown beyond the size specified in the read_me file. If you are worried, make the fields larger and try the process again after deleting all of the data out of the table.

Close

Search

Close

Share

Close

Dialog