Creating tables syntax error?

im tying to figure out my syntax error

CREATE TABLE users
(
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
first_name VARCHAR(50),
last_name VARCHAR(50),
email varchar(50),
UNIQUE (email),
PRIMARY KEY (id)
);

CREATE TABLE permissions
(
id SMALLINT UNSIGNED AUTO_INCREMENT,
directory VARCHAR(50),
description TEXT,
PRIMARY KEY (id)
);

CREATE TABLE users-permissions
(
user-id SMALLINT UNSIGNED,
permission-id SMALLINT UNSIGNED,
FOREIGN KEY (user-id) REFERENCES users (id),
FOREIGN KEY (permission-id) REFERENCES permissions (id),
PRIMARY KEY (user-id, permission-id)
);

heres the error


Thanks

use an underscore instead of a dash (which is interpreted as the arithmetic subtraction operator) in both table names and column names

1 Like

ok, made the change (it worked!)
Now im getting this error when I try to insert data


what is the error, the only thing I can think of is the descriptions data type is TEXT, but does that matter?

In this case, don’t think. look

what are those, images for ants?

any chance we could convince you to paste text into your posts?

1 Like

okay, i took the extraordinary step of downloading your image… then opened it up in a graphic editor, and zoomed in

you won’t believe what i found!!!

the error message tells you EXACTLY where the error is!!!

as @Mittineague said, take a look

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.