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

  • Home
  • SEARCH
  • 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 7866777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:30:18+00:00 2026-06-03T00:30:18+00:00

I am writing a program that accesses a database in order to make sure

  • 0

I am writing a program that accesses a database in order to make sure values are up to date. For example(this isn’t my real issue), I have an object that has a unique property. I want to ensure that the database has that same unique value saved. If it doesn’t, I want to update the database. This would happen in a script that runs in the background repeatedly to ensure that the value’s stay synchronized.

So my question is, would it be more cost effective to SELECT the value and compare, then UPDATE. Or should I just UPDATE automatically?

I imagine the SELECT and compare might be more efficient then just updating all the time, but I don’t know for certain.

Which should I go with?

Thanks (I apologize if this is a dumb question).

  • 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-06-03T00:30:20+00:00Added an answer on June 3, 2026 at 12:30 am

    It is a good question. It needs a sound knowledge of SELECT and UPDATE queries.

    UPDATE is used when you need to update existing records in a table with WHERE as to specify which record you need to update. so better to use UPDATE query.

    As far as cost and time effective, you can use different query analyzer to analysis the queries.

    UPDATE table_name
    SET value to update
    WHERE some condition to update
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first attempt at writing a program that accesses a database from
I'm writing a program that list the digits of integer input. example: Please enter
I am writing a program that reads '.exe' files and stores their hex values
There's a button in my program that, when clicked, accesses a huge database and
I' writing a program that stores opening hours for a store in a database
I'm currently writing a program that has debug output strewn throughout it. This is
I am writing an HTML program that will be accessed by over 500 people
Im writing a program that should read input via stdin, so I have the
I am writing a program that runs through pintools, to perform dynamic taint analysis
I'm writing a program that show the thread list of all opened process. With

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.