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));
相关问答:
大家好:
最近在wince下使用sqlite,但是由于表的内容量大,所以查询效率很低,不知道什么问题及怎么解决。
我的表的结构如下:
name&nbs ......
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_prepare 这个函数 select 就好使 只要 改变数据库 的就不行 比如insert 之类的 谁来帮个忙啊 请问这是什么原因 啊 用 c 去实现的
你用的什么工具啊?
把你自己的代码发 ......
XML code:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx ......
刚入门 想实现新闻表新闻置顶的功能
select * from web_news order by id desc limit 0,6
web_news 表里有TOP列 怎样让TOP列记录为1的为置前 各位大大们帮帮忙 分不多 请包涵!!
order ......