1
mysql> create table balance_sheet(
    -> Cash_and_cash_equivalents  VARCHAR(20),
    -> Trading_financial_assets  VARCHAR(20),
    -> Note_receivable  VARCHAR(20),
    -> Account_receivable  VARCHAR(20),
    -> Advance_money  VARCHAR(20),
    -> Interest_receivable  VARCHAR(20),
    -> Dividend_receivable  VARCHAR(20),
    -> Other_notes_receivable  VARCHAR(20),
    -> Due_from_related_parties  VARCHAR(20),
    -> Inventory  VARCHAR(20),
    -> Consumptive_biological_assets  VARCHAR(20),
    -> Non_current_asset(expire_in_a_year)  VARCHAR(20),
    -> Other_current_assets  VARCHAR(20),
    -> Total_current_assets  VARCHAR(20),
    -> Available_for_sale_financial_assets  VARCHAR(20),
    -> Held_to_maturity_investment  VARCHAR(20),
    -> Long_term_account_receivable  VARCHAR(20),
    -> Long_term_equity_investment  VARCHAR(20),
    -> Investment_real_eastate  VARCHAR(20),
    -> Fixed_assets  VARCHAR(20),
    -> Construction_in_progress  VARCHAR(20),
    -> Project_material  VARCHAR(20),
    -> Liquidation_of_fixed_assets  VARCHAR(20),
    -> Capitalized_biological_assets  VARCHAR(20),
    -> Oil_and_gas_assets  VARCHAR(20),
    -> Intangible_assets  VARCHAR(20),
    -> R&d_expense  VARCHAR(20),
    -> Goodwill  VARCHAR(20),
    -> Deferred_assets  VARCHAR(20),
    -> Deferred_income_tax_assets  VARCHAR(20),
    -> Other_non_current_assets  VARCHAR(20),
    -> Total_non_current_assets  VARCHAR(20),
    -> Total_assets  VARCHAR(20),
    -> Short_term_borrowing  VARCHAR(20),
    -> Transaction_financial_liabilities  VARCHAR(20),
    -> Notes_payable  VARCHAR(20),
    -> Account_payable  VARCHAR(20),
    -> Item_received_in_advance  VARCHAR(20),
    -> Employee_pay_payable  VARCHAR(20),
    -> Tax_payable  VARCHAR(20),
    -> Interest_payable  VARCHAR(20),
    -> Dividend_payable  VARCHAR(20),
    -> Other_account_payable  VARCHAR(20),
    -> Due_to_related_parties  VARCHAR(20),
    -> Non_current_liabilities_due_within_one_year  VARCHAR(20),
    -> Other_current_liabilities  VARCHAR(20),
    -> Total_current_liabilities  VARCHAR(20),
    -> Long_term_loan  VARCHAR(20),
    -> Bonds_payable  VARCHAR(20),
    -> Long_term_payable  VARCHAR(20),
    -> Specific_payable  VARCHAR(20),
    -> Estimated_liabilities  VARCHAR(20),
    -> Deferred_income_tax_liabilities  VARCHAR(20),
    -> Other_non_current_liabilities  VARCHAR(20),
    -> Total_non_current_liabilities  VARCHAR(20),
    -> Total_liabilities  VARCHAR(20),
    -> Paid_in_capital  VARCHAR(20),
    -> Contributed_surplus  VARCHAR(20),
    -> Treasury_stock  VARCHAR(20),
    -> Earned_surplus  VARCHAR(20),
    -> Retained_earnings  VARCHAR(20),
    -> Translation_reserve  VARCHAR(20),
    -> Nonrecurring_items  VARCHAR(20),
    -> Total_equity(non)  VARCHAR(20),
    -> Minority_interests  VARCHAR(20),
    -> Total_equity  VARCHAR(20),
    -> Total_liabilities_&_shareholder's_equity  VARCHAR(20));
    '>
    '> 

当我按回车时,有'>的输出,没有其他反应,这是怎么回事?

4

3 回答 3

4

你的问题在最后一行。列名不能包含&'

-> Total_liabilities_&_shareholder's_equity VARCHAR(20));

将其更改为:

-> Total_liabilities_shareholders_equity VARCHAR(20));

编辑

事实证明,MySQL 确实支持列名中的特殊字符,但您必须对它们进行转义:

-> `Total_liabilities_&_shareholder's_equity` VARCHAR(20));

出于可读性的原因,我强烈建议不要这样做。

文档

标识符可以被引用或不被引用。如果标识符包含特殊字符或者是保留字,则在引用它时必须引用它。当前字符集中的字母数字字符集“_”和“$”并不特殊。

标识符引号字符是反引号(“`”)。

于 2010-04-24T00:33:32.677 回答
2

在字段名称中仅使用字母数字字符。没有 & 和 ' 字符

于 2010-04-24T00:33:05.330 回答
1

SO 代码突出显示是一个提示。您的一个字段名称中有一个撇号,MySQL 将其解释为永远不会终止的字符串文字的开头。它正在耐心地等待你完成你的字符串。

于 2010-04-24T00:33:32.203 回答