I have this code, you can try on db-fiddle:
CREATE TABLE EMPLOYEE
( ID INT,
Name VARCHAR(15) NOT NULL,
Age INT,
Dnumber INT,
Level INT,
PRIMARY KEY (ID)
);
INSERT INTO EMPLOYEE (ID, Name, Age, Dnumber, Level) VALUES(1,'Tom', 21, 2, 5);
INSERT INTO EMPLOYEE (ID, Name, Age, Dnumber, Level) VALUES(2,'Lucky', 22, 2, 3);
INSERT INTO EMPLOYEE (ID, Name, Age, Dnumber, Level) VALUES(NULL,'Blue', 22, 2, 3);
If I use SQLite, I can add the NULL value but it cannot if I use MySQL. I will get this error:
Schema Error: Error: ER_BAD_NULL_ERROR: Column 'ID' cannot be null
What is the reason why I can add it to SQLite?
INTEGER PRIMARY KEY
, as documentation says in link for section 3.5. INT is just shorthand for INTEGER, but that phrase has another meaning syntactically and should be read as one element. – Tolerable