Hi there!I have a problem with sql.I am trying to build a db with 3 tables: Users, Products and Actions.The last one has the UIDs of the first two.Whan I'm trying to create the Actions table I get this error:
The SQL command for creating this table looks like this: CREATE TABLE Actions (ID INTEGER PRIMARY KEY, Timestamp TIMESTAMP NOT NULL, TypeID INTEGER NOT NULL, UserID REFERENCES Users , ProductID REFERENCES Products, Credit FLOAT(4,2), Quantity INTEGER);
I've tried to change it to this: CREATE TABLE Actions (ID INTEGER PRIMARY KEY, Timestamp TIMESTAMP NOT NULL, TypeID INTEGER NOT NULL, UserID REFERENCES Users(ID) , ProductID REFERENCES Products(ID), Credit FLOAT(4,2), Quantity INTEGER); but it doesn't seem to work as well because I get this error message:
Using a SQLite Online Compiler I've created the tables without any problem.You can see the commands in this page http://tpcg.io/CD89X0
I have to mention that I'm using a ESP8266 module(NodeMCU 1.0(ESP-12E Module to be more precise))
Hi @MarkT , thanks for your reply!I've tried to change my sql code in this CREATE TABLE Actions (ID integer,Timestamp timestamp not null, TypeID integer not null, UserID integer,ProductID integer, Credit float(4,2), Quantity int ,foreign key (UserID) references Users(id),foreign key (ProductID) references Products(id),primary key (ID)); and it doesn't seem to work either.This link willl redirect you to the SQL Compiler code that I've wrote: SQL Online Compiler.Also, this is the error that I'm getting from my ESP8266: