SQLite Forum

create table
Login

create table

(1) By Fardin on 2021-06-14 10:14:20

Hi, when try to create table syntax error even I change that to other syntax again same error appear near "user_id in line 3 and 10.
here is SQL table.
 
CREATE TABLE transactions (
 id INTEGER PRIMARY KEY AUTOINCREMENT,
 user_id INTEGER NOT NULL,
 name TEXT NOT NULL,
 shares INTEGER NOT NULL,
 price NUMERIC NOT NULL,
 type TEXT NOT NULL,
 symbol TEXT NOT NULL,
 time TIMESTAMP DEFAULT CURRENT_TIMRSTAMP,
 FORIEGN KEY(user_id) REFERENCES users(id)
);

(2) By Gunter Hick (gunter_hick) on 2021-06-14 10:28:50 in reply to 1 [link]

Try forEIgn instead of forIEgn

(3) By Tim Streater (Clothears) on 2021-06-14 11:00:30 in reply to 1 [link]

As Gunter said.

Also you can't spell CURRENT_TIMESTAMP.