SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Best practice for updating a product table

    If I'm given a table with products and I have to update my current db of products, what's the best practice to only update those rows that have changed ? The mysql version of linux diff, if you will. The table I'm given to update with is csv but can dumped into a temp table.
    Coupons, Deals, and Online Specials:
    http://www.couponsurfers.com

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,340
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    best practice is to write your own queries to check for updates, column by column, row by row

    mysql doesn't come with anything like this built in
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    alright, thanks for the quick reply.
    Coupons, Deals, and Online Specials:
    http://www.couponsurfers.com

  4. #4
    SitePoint Enthusiast
    Join Date
    Jan 2009
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    another idea - if you plan to maintain the data in a csv file, you could also detect changes and make updates using:

    1. pure string manipulation and regular expressions
    2. string to array conversions (which function depends on language) with a comma delimiter, and use array processing.

    hope that helps!


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •