SQL词典表是否应具有IDENTITY列 [英] Should an SQL Dictionary table have an IDENTITY column

查看:54
本文介绍了SQL词典表是否应具有IDENTITY列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序需要通用查找表 Dictionary ,只能由 KEY {VARCHAR(N)UNIQUE}

My application needs a generic lookup table Dictionary that should only be referenced by KEY {VARCHAR(N) UNIQUE}

我是否有理由不应该将 KEY 设置为主键?

Is there any reason I should not set KEY to be the primary key?

推荐答案

您绝对可以使用VARCHAR作为主键。但是作为主键,如果有任何机会,将很难进行更新。但是根据您的需要,您绝对可以使用VARCHAR作为主键

You can definitely use a VARCHAR as a primary key. But being a primary key it would be difficult to update in case of any chance. But as per your need you can definitely use VARCHAR as primary key

这篇关于SQL词典表是否应具有IDENTITY列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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