如何在sqlite ios中已制成的表中添加唯一约束? [英] How to add unique constraint in already made table in sqlite ios?

查看:86
本文介绍了如何在sqlite ios中已制成的表中添加唯一约束?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在已经通过sqlite数据库浏览器制作了数据库和表,因为我允许从Facebook向用户添加选定的朋友姓名,但是我不希望第二次在他们添加朋友时再在数据库中添加相同的名字,所以如何添加sqlite中的约束

i have made database and table already through sqlite database browser now as i let add selected friends names from facebook to user but i dont want that second time when they are adding then same names should not get added in database so how to add constraints in sqlite

我试图检查sqlite数据库浏览器,但是没有什么可以更改的

i tried to check sqlite database browser but there is nothing there to change it

我尝试过使用lita,但是在lita中有使其不为null和唯一的选项,但是我无法单击该复选框,我不知道为什么

i tried lita for it but in there is option in lita to make it non null and unique but i cant click that check box i dont know why

plz帮助

推荐答案

我假设您使用的是FireFox的SQLiteManager,请重新创建表,通常在创建表后不允许更改约束

I am assuming you are using SQLiteManager from FireFox, please create the table again, normally it doesn't allow to change the constraints when you have already created a table.

注意-也可以使用代码来完成,这是另一种方式.

NOTE - It can be done using code too, this is another way of doing it..

已编辑 见下图

这篇关于如何在sqlite ios中已制成的表中添加唯一约束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆