MySQL column name and reserved word duplicate problem resolution when you build a table

Source: Internet
Author: User

The following SQL statement was encountered when the table was built with the same name as the reserved word for MySQL that caused the table not to be built:

CREATE TABLETbl_account_frozen_record (IDBIGINT  not NULLauto_increment,trade_flow_idVARCHAR( -) not NULL, Account_noVARCHAR( +) not NULL, InitiatorVARCHAR( -) not NULL, Operate_typeVARCHAR( +) not NULL, CredentialVARCHAR( $), Modify_dateTIMESTAMP DEFAULT Current_timestamp, Unfrozen_dateTIMESTAMP, REASONVARCHAR( $), DESCRIBEVARCHAR( $), Create_dateTIMESTAMP,CONSTRAINTP_key_1PRIMARY KEY(ID)) ENGINE=InnoDBDEFAULTCHARSET=UTF8;

Where describe is a MySQL reserved word, to create a new table containing the column name, the field needs to be processed, plus the "•" is not a single or double quotation mark, but the top left-hand corner of the keyboard, the one on the left side of the "1" key:

The modified SQL statements are as follows, and the following table is established as normal:

CREATE TABLETbl_account_frozen_record (IDBIGINT  not NULLauto_increment,trade_flow_idVARCHAR( -) not NULL, Account_noVARCHAR( +) not NULL, InitiatorVARCHAR( -) not NULL, Operate_typeVARCHAR( +) not NULL, CredentialVARCHAR( $), Modify_dateTIMESTAMP DEFAULT Current_timestamp, Unfrozen_dateTIMESTAMP, REASONVARCHAR( $), ' DESCRIBE 'VARCHAR( $), Create_dateTIMESTAMP,CONSTRAINTP_key_1PRIMARY KEY(ID)) ENGINE=InnoDBDEFAULTCHARSET=UTF8;

MySQL column name and reserved word duplicate problem resolution when you build a table

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.