Create table上的SQLite错误

时间:2016-12-03 13:56:22

标签: sql sqlite

这:

create table cartao(
    _id integer primary autoincrement, 
    nome text not null
    );
create table vacina(
    _id integer primary autoincrement, 
    idCartao long not null, 
    nome text not null, 
    descricao text not null
);
create table remedio(
    _id integer primary autoincrement, 
    nome text not null
    );

SELECT * FROM CARTAO;

返回以下错误:

  

错误:接近"自动增量":语法错误

2 个答案:

答案 0 :(得分:1)

[关闭主题]在SQLite中, select listing.lid , sum(review.rNumber) as nor , count(review.rNumber) as total , users.username from listing left join review on listing.lid=review.lID inner join users on users.uid=listing.cuid where cat='Hair group by listing.lid,users.username 没有AUTOINCREMENT就可以了

You forgot KEY after PRIMARY :

应该是 _

SQL Fiddle

SQLite(SQL.js)架构设置

_id integer primary key autoincrement

查询1

create table cartao(_id integer primary key autoincrement, nome text not null);

Insert into cartao(nome) Values('test 1'),('test 2');

<强> Results

SELECT * FROM CARTAO

答案 1 :(得分:-2)

使用 AUTO_INCREMENT 代替查询中的自动增量