0

I haven't done much on databases ever but I am now required to do so for University. I have built a schema which can be found below and also made a data.sql file to inset so data. I'm getting the error "Error: near line 1: Near NULL: Syntax error", but I can't see what the issue is, I know it will be something simple which I have done wrong but I would appreciate the help. Thank you.

Schema.sql

DROP TABLE users;
CREATE TABLE users(id integer primary key, username varchar(30), password varchar(30), email varchar(50), receive_email blob, gender varchar(6));

DROP TABLE lists;
CREATE TABLE lists(id integer primary key, user_id integer, list_id integer, name varchar(50), creation_date datetime, importance integer, completed blob);

DROP TABLE list_item;
CREATE TABLE list_item(id integer primary key, list_id integer, name varchar(50), creation_date datetime, completed blob);

data.sql

INSERT INTO users(NULL, "kieran", "password", "[email protected]", "1", "male");
INSERT INTO users(NULL, "test", "testpassword", "test_email", "0", "female");

Thank you in advance.

1 Answer 1

1

Looks like you want to have VALUES there, e.g.

INSERT INTO users VALUES(NULL, ...

Otherwise you'd be specifying the columns to insert into, and NULL is not a valid column name.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, I knew it would be something simple like that. I'll accept as soon as I can.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.