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));
'>
'>
当我按回车键时,有'>的输出没有其他反应,怎么了?
答案 0 :(得分:4)
你的问题在最后一行。列名不能包含&
或'
:
-> Total_liabilities_&_shareholder's_equity VARCHAR(20));
将其更改为:
-> Total_liabilities_shareholders_equity VARCHAR(20));
修改强>
事实证明MySQL确实支持列名中的特殊字符,但你必须将它们转义:
-> `Total_liabilities_&_shareholder's_equity` VARCHAR(20));
出于可读性原因,我强烈建议不要这样做。
来自docs:
可以引用标识符或 不带引号的。如果标识符包含 特殊字符或是保留的 一句话,你必须随时引用它 参考它。一组字母数字 当前角色的字符 设置,“_”和“$”并不特殊。
标识符引号字符是反引号(“`”)。
答案 1 :(得分:2)
在字段名称中仅使用字母数字字符。没有&和'人物
答案 2 :(得分:1)
SO代码突出显示是一个提示。你的一个字段名中有一个撇号,MySQL正在将其解释为永远不会终止的字符串文字的开头。它耐心等待你完成你的字符串。