sqlite 中
CREATE TABLE table1 (
id integer primary key autoincrement,
name text default '',
[index] integer default ROWID
)
有没有类似的功能,让 index 的值默认等于id,比如
insert into table1 (id,name) values (null,'第一行');
insert into table1 (id,name) values (null,'第二行');
我希望结果是
id name index
1 第一行 1
2 第二行 2
能实现吗?
一定要用到触发器和存储过程吗?不能直接设置成默认值吗
呵呵,不能,测试了一下不行
嗯,知道了,果然是不行的
测试可以这样 :
insert into table1c values (null,'第一行',(select rowid from table1c));
相关问答:
我现在手头有这么一个问题,我想让一个操作sqlite3的程序在一个ARM板子上跑起来,板子上的os是wince5.0。
我是这么做的,我先从sqlite3主页下载源码下来,有这么3个文件:sqlite3.c、sqlite3.h、sqlite3ext.h , ......
sqlite的空值查询怎么写,能者得分
select * from tt where f1 is null
select * from yourTable where col is null;
SQL code:
sqlite> create table Aoqun (id int primary key,col1 int);
sqlite> ......
最简单的问题。也有点郁闷。
我想创建一个数据库
我现在只有一个sqlite3.exe文件。
我使用的方法是双击这个文件
使用的命令为:
sqlite3 f:\a.db 回车
可是结果却显示为
...>
sqli ......
刚入门 想实现新闻表新闻置顶的功能
select * from web_news order by id desc limit 0,6
web_news 表里有TOP列 怎样让TOP列记录为1的为置前 各位大大们帮帮忙 分不多 请包涵!!
order ......