这两种做法哪个更好?
我要戒烟了 2013-11-07 12:00:01 我想检查数据库中是否有满足条件的信息
假设表名为 good_info
有两个栏位
一个是username 一个是fb_id
需求是搜索出是否有与指定username和fb_id都相等的信息
1.
表中没有设主键
select * from good_info where username='~s' and fb_id=~p
然后看返回的结果中是否有数据
或是
2.
表中没有设username为主键
"select fb_id from good_info where username='~s'
然后在返回的信息中再进行筛选
不知道哪种更科学点呢?