Do all items in a SQLite table have an id?

Question

Do all items in an SQLite table have an id?

Answer

Yes, as a matter of fact, all SQL tables are indexed, which means that it arranges in a numerical order its content, therefore every item in a table has a unique identifier (id) from which we can select it. for example, a table of users may look like so:

name | age


John| 22
Axel | 29
Phillip Pirrip | 16

John | 22

Now we can see that there can be an issue with the second John entry, that is why SQL databases require ids, that way there will be a unique identifier for each row entered, so our table actually looks like so:

id |name | age


1 |John| 22
2 | Axel | 29
3 | Phillip Pirrip | 16

123 | John | 22

This way we know that John with id 1 is a completely different John from John with id 123, even though both also share the same age.

Something to keep in mind is that the identifier (also called primary key, or index) does not have to have a specific name ie. id, and it is not 100% required, but there will always be a need for a unique key or set of keys (in case of most No-SQL databases), to be able to access a specific row in a table.