The problem that the MySQL table field name contains a minus sign

Source: Internet
Author: User


The problem that the MySQL table field name contains a minus sign
When inserting data into MySQL Data, the SQL syntax error is always prompted. After half a day of check, it turns out that the table name contains a minus sign. Original TABLE structure: SQL code CREATE TABLE IF NOT EXISTS 'Amazon-sellertransactions' ('record-insert-time' timestamp NOT NULL DEFAULT CURRENT-TIMESTAMP ON UPDATE CURRENT-TIMESTAMP, 'record-id' int (10) unsigned not null auto-INCREMENT, 'Amazon-order-id' varchar (30) default null, 'Merchant-id' varchar (30) default null, 'purchase-date' datetime default null, 'last-update-date' datetime default null, 'order-status' varchar (50) default null, 'fulfillment-channel' varchar (20) default null, 'sales-channel' varchar (50) default null, 'shipments-service-level' varchar (50) default null, 'order-total' varchar (30) default null, 'buyer-name' varchar (50) default null, www.2cto.com 'buyer-email 'varchar (60) default null, 'Number-items-shipped 'varchar (10) default null, 'Number-items-unshipped' varchar (10) default null, 'ship-City' varchar (50) default null, 'ship-state' varchar (50) default null, 'ship-postal-Code' varchar (50) default null, 'ship-country 'varchar (50) default null, 'ship-name' varchar (50) default null, 'ship-phone' varchar (30) default null, 'ship-address-line1 'varchar (120) default null, 'payment-method' varchar (30) default null, primary key ('record '), unique key 'Amazon-order-id' ('Amazon-order-id ')) ENGINE = MyISAM default charset = utf8 AUTO_INCREMENT = 1; this SQL code creates a table. However, a syntax error is reported in related operations, and quotation marks cannot be added. Therefore, only TABLE field names can be modified. The modified SQL code is as follows: SQL code CREATE TABLE IF NOT EXISTS 'Amazon _ sellertransactions' ('record _ insert_time' timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 'record _ id' int (10) unsigned not null AUTO_INCREMENT, 'Amazon _ order_id 'varchar (30) default null, 'Merchant _ id' varchar (30) default null, 'purchase _ date' datetime default null, 'last _ update_date 'datetime default null, 'order _ status' varchar (50) default null, 'fulfillment _ channel' varchar (20) default null, 'sales _ channel' varchar (50) default null, 'shipments _ service_level 'varchar (50) default null, 'order _ total' varchar (30) default null, 'bucket _ name' varchar (50) default null, www.2cto.com 'bucket _ email 'varchar (60) default null, 'Number _ items_shipped' varchar (10) default null, 'Number _ items_unshipped 'varchar (10) default null, 'ship _ City' varchar (50) default null, 'ship _ state' varchar (50) default null, 'ship _ postal_code 'varchar (50) default null, 'ship _ country' varchar (50) default null, 'ship _ name' varchar (50) default null, 'ship _ phone' varchar (30) default null, 'ship _ address_line1 'varchar (120) default null, 'payment _ method' varchar (30) default null, primary key ('record '), unique key 'Amazon _ order_id' ('Amazon _ order_id ') ENGINE = MyISAM default charset = utf8 AUTO_INCREMENT = 1;

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.