Are auto-generated SQL database integer indices always greater than zero?

entity-framework-core sql sqlite

Question

In my EF Core 3.1/WPF application, I've noticed that every time I declare an integer column as a key in one of my EF Core entities (using the [Key] attribute), the database-generated index values always are always positive

Is this some sort of universal SQL rule that one can always count on? i.e. That auto-generated integer database indices are always greater than zero? I suspect not

(Tagged this with EF core as well because I'm not sure if the EF core could have any effect on the answer and with Sqlite because even if it's only a Sqlite thing, I wouldn't mind knowing.)

1
0
3/7/2020 8:53:28 PM

Accepted Answer

"If no negative ROWID values are inserted explicitly, then automatically generated ROWID values will always be greater than zero."
https://www.sqlite.org/autoinc.html

1
3/7/2020 10:26:23 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow