-2
create table clients_info (
  id MEDIUMINT NOT NULL AUTO_INCREMENT,
  name CHAR(30) NOT NULL,
  join-date DATE,
  credit DOUBLE(15,0) zerofill,
  PRIMARY KEY(id)
);

You have an error in your SQL syntax on for the right syntax to use near 'join-date DATE,credit DOUBLE(15,0) zerofill,PRIMARY KEY(id) )' at line

The Impaler
  • 45,731
  • 9
  • 39
  • 76

1 Answers1

0

As @GordonLinoff says hyphens (-) are not allowed by default in column names (in identifiers). Nevertheless, you can use it if you enclose the identifier in back ticks, as in:

create table clients_info (
  id MEDIUMINT NOT NULL AUTO_INCREMENT,
  name CHAR(30) NOT NULL,
  `join-date` DATE,
  credit DOUBLE(15,0) zerofill,
  PRIMARY KEY(id)
);

Or better off, use an underscore (_) instead to avoid using back ticks everywhere, as in:

create table clients_info (
  id MEDIUMINT NOT NULL AUTO_INCREMENT,
  name CHAR(30) NOT NULL,
  join_date DATE,
  credit DOUBLE(15,0) zerofill,
  PRIMARY KEY(id)
);

I personally prefer the latter.

The Impaler
  • 45,731
  • 9
  • 39
  • 76