This simple sqlite query:
CREATE TABLE customers
(
id INT(255) NOT NULL AUTO_INCREMENT,
name VARCHAR(255),
email VARCHAR(255),
password VARCHAR(255),
PRIMARY KEY (id)
);
is not working.
On
SQL lite doesn't support cahrchar or auto increment (at least not without rowid
see manual
CREATE TABLE t(id INTEGER PRIMARY KEY ASC, name TEXT , email TEXT , password TEXT);
INSERT INTO t (name,email, password) VALUES ('abc','bcd','efg')
INSERT INTO t (name,email, password) VALUES ('abc2','bcd2','efg2')
SELECT * FROM t;id | name | email | password -: | :--- | :---- | :------- 1 | abc | bcd | efg 2 | abc2 | bcd2 | efg2
db<>fiddle here
This is the correct syntax for the definition of the table:
SQLite does not support
AUTOINCREMENTwhen the column's data type is other thanINTEGERand the column is not thePRIMARY KEYof the table.Also there are no
int(255)andVARCHARdata types in SQLite (although you can use it in theCREATE TABLEstatement). UseTEXTinstead ofVARCHAR.See the demo.