MySQL 列的列说明符不正确
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18347282/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
incorrect column specifier for column
提问by Robert Rocha
I have:
我有:
create table `products`
(
`id` int(11) not null auto_increment,
`price` float(255),
`weight` int(11),
`sku` varchar(255),
`stock_level` int(11),
`image` mediumblob(1000),
`search_engine_name` varchar(255),
`description` varchar(1000),
`url` varchar(255),
`category` varchar(255),
primary key (`id`)
);
MySql outputs: "Incorrect column specifier for column 'price'
MySql 输出:“列‘价格’的列说明符不正确
Why is this?
为什么是这样?
回答by nkvu
float(255)
is not valid when specifying the data type.
float(255)
指定数据类型时无效。
You can omit the value in the brackets, e.g. just have float
by itself or specify the value in the brackets using something like float(7,4)
(see thisfor information on what the values mean...you may need to customise these depending on what you're intending to store in the column)
您可以省略括号中的值,例如float
,单独使用或使用类似的内容指定括号中的值float(7,4)
(有关这些值的含义的信息,请参阅this...您可能需要根据您的意图自定义这些值存储在列中)