在 SQL 中创建表

在 SQL 中创建表

我正在尝试使用 SQL 创建一个表,作为一名初学者,我不知道哪里出错了。

这是我的代码:

    CREATE TABLE 'test_11' (
  `Company_Name` varchar(160),
  `Company_Number` varchar(8),
  `Care_Of` varchar(100),
  `PO_Box` varchar(10),
  `Address_line1` varchar(300),
  `Address_line2` varchar(300),
  `Post_town` text,
  `County` varchar(50),
  `Country` text,
  `Post_Code` varchar(20),
  `Category` varchar(100),
  `Status` varchar(70),
  `Country_of_Origin` text,
  `Dissolution_Date` date,
  `Incorporation_Date` date,
  `Accounting_refday` int(2),
  `Accounting_refmonth` int(2),
  `Next_due_date` date,
  `Last_made_up_date` date,
  `Accounting_category` text,
  `Returns_next_due_date` date,
  `Returns_last_made_up_date` date,
  `Num_mort_changes` int(6),
  `Num_mort_outstanding` int(6),
  `Num_mort_part_satisfied` int(6),
  `Num_mort_satisfied` int(6),
  `SIC_code1` varchar(170),
  `SIC_code2` varchar(170),
  `SIC_code3` varchar(170),
  `SIC_code4` varchar(170),
  `Num_gen_partners` int(6),
  `Num_lim_partners` int(6),
  `URL` varchar(47),
  `Change_of_name_date` date,
  `Company_name_previous` varchar(160)
) ENGINE=InnoDB DEFAULT CHARSET =latin1;

有人能帮助我并告诉我出了什么问题吗?

答案1

问题在于表名附近的语法。从中删除引号test_11

  CREATE TABLE test_11 (
  `Company_Name` varchar(160),
  `Company_Number` varchar(8),
  `Care_Of` varchar(100),
  `PO_Box` varchar(10),
  `Address_line1` varchar(300),
  `Address_line2` varchar(300),
  `Post_town` text,
  `County` varchar(50),
  `Country` text,
  `Post_Code` varchar(20),
  `Category` varchar(100),
  `Status` varchar(70),
  `Country_of_Origin` text,
  `Dissolution_Date` date,
  `Incorporation_Date` date,
  `Accounting_refday` int(2),
  `Accounting_refmonth` int(2),
  `Next_due_date` date,
  `Last_made_up_date` date,
  `Accounting_category` text,
  `Returns_next_due_date` date,
  `Returns_last_made_up_date` date,
  `Num_mort_changes` int(6),
  `Num_mort_outstanding` int(6),
  `Num_mort_part_satisfied` int(6),
  `Num_mort_satisfied` int(6),
  `SIC_code1` varchar(170),
  `SIC_code2` varchar(170),
  `SIC_code3` varchar(170),
  `SIC_code4` varchar(170),
  `Num_gen_partners` int(6),
  `Num_lim_partners` int(6),
  `URL` varchar(47),
  `Change_of_name_date` date,
  `Company_name_previous` varchar(160)
) ENGINE=InnoDB DEFAULT CHARSET =latin1;

SQLFiddle

相关内容