dimanche 11 octobre 2015

Sqlite: insert default as previous value in column

I'm someone new to sql/database design, and trying to do the following...

I have a column that will be entering data, if data is not inserted, then default should be a previous/last value. How can this be achieved?

Example: 
id  val1    
1   155 
2   165
3   IF NO VALUE ENTERED, INSERT DEFAULT FROM LAST VALUE, WHICH IS 165.

If there is a post out there that answers this question, that would be great as well.

Thanks!

Aucun commentaire:

Enregistrer un commentaire