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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:56:59+00:00 2026-05-26T15:56:59+00:00

the table named: products . it have five hundred rows record. the table have

  • 0

the table named: products. it have five hundred rows record. the table have field :products_model products_price. the products_model is unique。

the original value that stored in products table are all 0.0000. now i want to update it with batch in phpmyadmin according to the ‘products_model`.

i prepared the data in excel with two columns, ‘products_modelthe new valueproducts_price`(according to some reason, some may be empty). how do i do? thank you.

the data form a csv file :

products_model  products_price
LB2100  
LB2117  12.49
LB2381  35.99
LB2307  12.99
LB2380  35.99
LB2468  10.99
LB2139  
LB2223  
LB2027  15.99
LB2126  12.99
LB2308  9.99
LB2124  13.99
LB2077  
LB2361  
LB2021  14.99
LB2129  
LB2010  11.21
LB2186  
LB2039  15.66
LB2153  
LB2564  30.99
LB2104  
LB1182  15.99
LB2034  15.9
LB2455  15.55
LB2189  
LB2559  22.9
LB2382  35.99
LB2168  10.99
  • 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-26T15:57:00+00:00Added an answer on May 26, 2026 at 3:57 pm

    Two steps:

    1. Store excel file as CSV (Excel allows it).
    2. Use LOAD DATA INFILE statement with REPLACE keyword to update your table.

    Edit:

    About the REPLACE keyword –
    From the reference – If you specify REPLACE, input rows replace existing rows. In other words, rows that have the same value for a primary key or unique index as an existing row.

    The usage is the same –

    LOAD DATA INFILE 'file_name' REPLACE INTO TABLE tbl_name FIELDS TERMINATED BY...
    

    Code

    Create and populate the table:

    CREATE TABLE products(
      products_model VARCHAR(6) NOT NULL,
      products_price DECIMAL(5, 2) DEFAULT NULL,
      PRIMARY KEY (products_model)
    );
    
    INSERT INTO products VALUES 
      ('LB2307', 100.00),
      ('LB2380', 200.00),
      ('LB2468', 300.00);
    

    Let’s import data from CSV:
    Specify FIELDS TERMINATED, LINES TERMINATED and other paramaters for your task

    LOAD DATA INFILE 'file_name.csv' REPLACE INTO TABLE products
    FIELDS TERMINATED BY '  '
    LINES TERMINATED BY '\r\n'
    IGNORE 1 LINES
    (products_model, @var1)
    SET products_price = IF(@var1 = '', 0, @var1); -- Replace empty string with 0
    

    Check results:

    SELECT * FROM products;
    +----------------+----------------+
    | products_model | products_price |
    +----------------+----------------+
    | LB1182         |          15.99 |
    | LB2010         |          11.21 |
    | LB2021         |          14.99 |
    | LB2027         |          15.99 |
    | LB2034         |          15.90 |
    | LB2039         |          15.66 |
    | LB2077         |           0.00 |
    | LB2100         |           0.00 |
    | LB2104         |           0.00 |
    | LB2117         |          12.49 |
    | LB2124         |          13.99 |
    | LB2126         |          12.99 |
    | LB2129         |           0.00 |
    | LB2139         |           0.00 |
    | LB2153         |           0.00 |
    | LB2168         |          10.99 |
    | LB2186         |           0.00 |
    | LB2189         |           0.00 |
    | LB2223         |           0.00 |
    | LB2307         |          12.99 |
    | LB2308         |           9.99 |
    | LB2361         |           0.00 |
    | LB2380         |          35.99 |
    | LB2381         |          35.99 |
    | LB2382         |          35.99 |
    | LB2455         |          15.55 |
    | LB2468         |          10.99 |
    | LB2559         |          22.90 |
    | LB2564         |          30.99 |
    +----------------+----------------+
    

    Good luck!

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

Sidebar

Related Questions

I have a table named visiting that looks like this: id | visitor_id |
Let's say I have a table named products and I want to know how
I currently have a table listing all of the products that are in the
I have a table named tbl.Products , which has a column named articlenumber and
In setting up a MySQL database, consider that I have a table of products
I have a table named product , where in the category field I have
If i have a table named products and its structure looked like this id
Hello I have a products table having fields products_id,products_number,products_status,products_price where products_id is auto_increment and
I have a database table named call with columns call_time, location, emergency_type and there
I have a table named Info of this schema: int objectId; int time; int

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.