创建 Table 小数错误
Create Table DECIMAL Error
我正在使用 Raspberry PI 运行 Raspbian。我已经到了要设置 MySql 数据库的地步,我正在尝试创建 DECIMAL table.
我正在关注这个 guide。
这是我正在使用的代码
Use Monitoring;
create table TempHumid (ComputerTime INTEGER UNSIGNED);
#This one created the table, but it was a different type.
create table Temperature (DECIMAL(5,1);
create table Humidity (DECIMAL(5,1);
这是它给我的错误。
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near 'DECIMAL (5,1))' at line 1
我尝试在 Google 和此处四处查看,但这些解决方案似乎没有用。我是 PI 的新手,所以这可能只是用户错误。
您应该指定您的列。见下文:
CREATE TABLE Temperature (
Temperature DECIMAL(5,1)
);
CREATE TABLE Humidity (
Humidity DECIMAL(5,1)
);
我正在使用 Raspberry PI 运行 Raspbian。我已经到了要设置 MySql 数据库的地步,我正在尝试创建 DECIMAL table.
我正在关注这个 guide。
这是我正在使用的代码
Use Monitoring;
create table TempHumid (ComputerTime INTEGER UNSIGNED);
#This one created the table, but it was a different type.
create table Temperature (DECIMAL(5,1);
create table Humidity (DECIMAL(5,1);
这是它给我的错误。
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECIMAL (5,1))' at line 1
我尝试在 Google 和此处四处查看,但这些解决方案似乎没有用。我是 PI 的新手,所以这可能只是用户错误。
您应该指定您的列。见下文:
CREATE TABLE Temperature (
Temperature DECIMAL(5,1)
);
CREATE TABLE Humidity (
Humidity DECIMAL(5,1)
);