My question is, is it correct to define as NOT NULL
in a primary call in a database SQLite
for Android
?, example:
ID INTEGER NOT NULL PRIMARY KEY
My question is, is it correct to define as NOT NULL
in a primary call in a database SQLite
for Android
?, example:
ID INTEGER NOT NULL PRIMARY KEY
In SQLite
(and other databases), if you declare a field as Primary Key
it is necessary that it is set as NOT NULL
, since you never must have null values
Although in SQLite
if you declare your field as Primary Key
, they are automatically set to NOT NULL
.
create table Personas (
P_Id number primary key,
LastName varchar(255),
FirstName varchar(255) not null
);