我创建表格
create table if not exists gbpExchangeRates (
date date
, to_currency char(3)
, rate float
, index idx (date, to_currency)
);
然后添加然后尝试插入数据
INSERT INTO gbpExchangeRates ('date', 'to_currency', 'rate') VALUES ('2018-01-22', 'CAD', 1.7253437447) ;
但是出现以下错误
SQL Error [1064] [42000]: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''date', 'to_currency', 'rate') VALUES ('2018-01-22', 'CAD', 1.7253437447)' at line 1
我尝试了以下操作,但仍收到错误消息:
ALTER TABLE gbpExchangeRates MODIFY to_currency char(10);
ALTER TABLE gbpExchangeRates MODIFY to_currency varchar(10);
ALTER TABLE gbpExchangeRates MODIFY rate double;
ALTER TABLE gbpExchangeRates MODIFY to_currency varchar(10);
INSERT INTO gbpExchangeRates ('date', 'to_currency', 'rate') VALUES ('2018-01-22', 'CAD', 1.72) ;
我的表和/或插入语句出了什么问题?
如果不存在,我会创建一个表创建表gbpExchangeRates(date date,to_currency char(3),rate float,index idx(date,to_currency));然后添加,然后尝试插入数据...
INSERT INTO gbpExchangeRates (date, to_currency, rate) VALUES ('2018-01-22', 'CAD', 1.7253437447) ;