我有一个包含错误的查询他们在哪?

问题描述

我想在sqlite中创建一个表,但是不能:

for(int j = 0,bool comma = false; j < size; j++)
{
    if (price[i][j] > 0)
    {
        if (comma)
            cout << ",";
        cout << airports[j];
        comma = true;
    }
}

这是其他表格,但是可以。我对他们没有问题:

CREATE TABLE IF NOT EXISTS[Goods] 
                    (GoodId INTEGER PRIMARY KEY AUTOINCREMENT,GoodName varchar(100) not null,CategoryId INTEGER FOREIGN KEY (CategoryId) REFERENCES Category (CategoryId),ProducerId INTEGER FOREIGN KEY (ProducerId) REFERENCES Producer (ProducerId),Price REAL not null,GoodCount REAL not null)

解决方法

内联外键不使用FOREIGN KEY关键字。

考虑:

CREATE TABLE IF NOT EXISTS[Goods] (
    GoodId INTEGER PRIMARY KEY AUTOINCREMENT,GoodName varchar(100) not null,CategoryId INTEGER REFERENCES Category (CategoryId),ProducerId INTEGER REFERENCES Producer (ProducerId),Price REAL not null,GoodCount REAL not null
)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...