user902383
user902383

Reputation: 8640

how many foreign key you can have in sqlite table

i spent last few hours trying to find what is wrong in my code(?)

CREATE TABLE transaction (
id NUMERIC PRIMARY KEY,
user_id NUMERIC NOT NULL,
account_id NUMERIC NOT NULL,
category_id NUMERIC NOT NULL,
amount DOUBLE NOT NULL, date VARCHAR(25) NOT NULL,
description VARCHAR(25),
FOREIGN KEY(account_id) REFERENCES account(id),
FOREIGN KEY(user_id) REFERENCES user(id),
FOREIGN KEY(category_id) REFERENCES category(id)
);

to find what is wrong i was adding one column after another, and i noticed i cant create table with more than two foreign keys, is it limit or am i doing something wrong? can i walk this around somehow? im not interested in this case, because i realized i need to change design of my db anyway

regards

Upvotes: 2

Views: 2312

Answers (1)

stefan bachert
stefan bachert

Reputation: 9616

VARCHAR is wrong. Should be TEXT

DOUBLE should be REAL

Upvotes: 1

Related Questions