Search code examples
androidsqliteandroid-sqlite

Can we update the sqlite table with out inserting data to it?


I have an Activity1 where i am inserting(insert query) the data in to table.But sometimes,app will directly come to Activity2 where it has code for updating the table.Update query is executing perfectly but the data is not present in table.Can we "Update the table without inserting(insert query) the data to it"?


Solution

  • No, this is not possible as UPDATE actually updates existing data, without any data UPDATE operation can't be performed. You can check if the data exists and UPDATE or INSERT the data if it doesn't exist.