标签:des style blog http color ar sp div on
建表时遇到遇到属性名同MySQL的保留字相同导致不能建表的问题,如下SQL语句:
CREATE TABLE TBL_ACCOUNT_FROZEN_RECORD ( ID BIGINT NOT NULL AUTO_INCREMENT, TRADE_FLOW_ID VARCHAR(60) NOT NULL, ACCOUNT_NO VARCHAR(32) NOT NULL, INITIATOR VARCHAR(16) NOT NULL, OPERATE_TYPE VARCHAR(32) NOT NULL, CREDENTIAL VARCHAR(36), MODIFY_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UNFROZEN_DATE TIMESTAMP, REASON VARCHAR(200), DESCRIBE VARCHAR(200), CREATE_DATE TIMESTAMP, CONSTRAINT P_Key_1 PRIMARY KEY (ID) )ENGINE=InnoDB DEFAULT CHARSET=utf8;
其中DESCRIBE为MySQL保留字,要想新建包含该列名的表,需要对该字段进行处理,加上“·”号,不是单引号也不是双引号,而是键盘最左上角的符号,在“1”按键左侧的那个:
修改后的SQL语句如下,执行后表建立正常:
CREATE TABLE TBL_ACCOUNT_FROZEN_RECORD ( ID BIGINT NOT NULL AUTO_INCREMENT, TRADE_FLOW_ID VARCHAR(60) NOT NULL, ACCOUNT_NO VARCHAR(32) NOT NULL, INITIATOR VARCHAR(16) NOT NULL, OPERATE_TYPE VARCHAR(32) NOT NULL, CREDENTIAL VARCHAR(36), MODIFY_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UNFROZEN_DATE TIMESTAMP, REASON VARCHAR(200), `DESCRIBE` VARCHAR(200), CREATE_DATE TIMESTAMP, CONSTRAINT P_Key_1 PRIMARY KEY (ID) )ENGINE=InnoDB DEFAULT CHARSET=utf8;
标签:des style blog http color ar sp div on
原文地址:http://www.cnblogs.com/wanggangblog/p/4048494.html