如何给Sqlite添加复合主键
2012-02-21 10:45
597 查看
如果是想两个字段组成一个复合主键的话可以如下。
SQL code
SQL code
sqlite> create table t2 ( ...> id1 int , ...> id2 int, ...> col varchar(20), ...> constraint pk_t2 primary key (id1,id2) ...> ); sqlite> 如果是双主键如下:sqlite> create table t1 ( ...> id int primary key, ...> col varchar(20) ...> ); sqlite> create unique index uk_t1 on t1 (col);
相关文章推荐
- Hibernate: 复合主键 (Composite Key) 如何兼容 NULL值
- 一开始 一直不明白,主键自动增长sqlite里面是如何插入的
- jpa的复合主键中关系中如何配置才能做到级联删除,我现在的问题是现在有一个学生类一个课程类,下面补充
- 如何在sqlserver数据库表中建立复合主键
- MySQL如何创建主键,外键和复合主键
- 添加和删除索引以及如何给中间表添加两个主键
- 如何在数据库表中建立复合主键
- 如何在sqlserver数据库表中建立复合主键
- mysql 如何修改、添加、删除表主键
- NHibernate: 复合主键 (Composite Key) 如何兼容 NULL值
- [iPhone-Sqlite3]如何为项目添加一个SqliteHelper,打开,插入,查询等
- Access数据库如何获取刚添加记录的ID(主键,自动编号)
- sqlite插入数据后如何获得插入数据的主键
- 在IOS工程中如何添加SQLite的libsqlite3.dylib
- mysql复合主键如何设定自增长属性
- 数据库如何添加主键?
- XAF 如何使用复合主键和复合外键
- 如何在有主键的情况下添加可以自增的字段
- XAF 如何使用复合主键和复合外键
- mysql 如何修改、添加、删除表主键