0

我正在尝试创建一个表,但不断收到此Syntax error: unexpected NULL_SYM, expecting '('错误。

CREATE TABLE `project` (

`project_id` int UNSIGNED NOT NULL AUTO_INCREMENT,

`project_name` varchar NULL,

`location` varchar NULL,

`date` datetime NULL,

`status` varchar NULL,

`specifier` varchar NULL,

`supplier` varchar NULL,

`cost` float NULL,

`sales_amount` float NULL,

`estimate_qty` float NULL,

`unit` varchar NULL,

`proposed_office` varchar NULL,

`proposed_person` int NULL,

`followed_office` varchar NULL,

`followed_person` int NULL,

`remark` varchar NULL,

PRIMARY KEY (`project_id`) 

);

错误在'project_name' varchar NULL,

4

1 回答 1

2

您需要指定varchar列的长度。例子

`project_name` varchar(100) NULL

它可能看起来像这样

CREATE TABLE `project` 
(
    `project_id` int UNSIGNED NOT NULL AUTO_INCREMENT,
    `project_name` varchar(100) NULL,
    `location` varchar(100) NULL,
    `date` datetime NULL,
    `status` varchar(10) NULL,
    `specifier` varchar(100) NULL,
    `supplier` varchar(100) NULL,
    `cost` decimal NULL,
    `sales_amount` decimal NULL,
    `estimate_qty` decimal NULL,
    `unit` varchar(10) NULL,
    `proposed_office` varchar(100) NULL,
    `proposed_person` int NULL,
    `followed_office` varchar(100) NULL,
    `followed_person` int NULL,
    `remark` varchar(200) NULL,
    PRIMARY KEY (`project_id`) 
);
于 2013-10-10T08:06:14.843 回答