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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:54:09+00:00 2026-05-14T21:54:09+00:00

I have a database full of simple note data, with columns for title, due

  • 0

I have a database full of simple note data, with columns for title, due date, priority, and details. There is also a _id column PRIMARY KEY int.

Say I have a note in the table already with some data filled and the rest null. I also have a set of data that will fill all those fields.

Is there a way that I can only write data to the fields that are NULL?

I can’t overwrite existing data, but I’d like to add data to NULL columns.

I know the rowId of the target row.

If my target row had rowId of 5, I could do something like this:

UPDATE SET duedate='some date', priority='2', details='some text' WHERE _id=5

But that would overwrite all the data in that row, and I don’t want to lose any data that might be there. How can I change this statement to avoid writing to non-null fields?

  • 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-14T21:54:10+00:00Added an answer on May 14, 2026 at 9:54 pm

    Suppose you start with

    CREATE TABLE "t" ("a" , "b" , "c" );
    INSERT INTO "t" ("a", "c") VALUES (1, 3);
    

    Then

    update t set a = coalesce(a,9), b = coalesce(b,10), c = coalesce(c,11);
    

    Will update only the null values, ie. only column B will be set to 10. A and C will be left alone because they contain values.

    Coalesce means pick the first item in the list that is not null.

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

Sidebar

Related Questions

I have a database full of two-dimensional data - points on a map. Each
Problem: I have a symfony project with a database full of production data I
I have a database full of text fields that look like this: (paragraph of
I have a database full of items, which should be searchable by any or
I have a database table full of time points and experimental values at those
We have an application that has a database full of polygons (currently stored as
I have a database table which is full-text indexed and i use the CONTAINS-function
I have a full backup MYSQL database. mysqldump -u root --password=SSS -A > D:\bkps\mysql.sql
I have exported a full backup of a database with HeidiSQL 7. Now when
EDIT: Note that due to the way hard drives actually write data, none of

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.