Issue
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
Solution
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.
Answered By - The Impaler Answer Checked By - Clifford M. (WPSolving Volunteer)