SQL 主键可以接受'0'吗? [英] SQL primary key can accept '0'?

查看:30
本文介绍了SQL 主键可以接受'0'吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SQL Server 2008/2005

SQL Server 2008 / 2005

我对主键和唯一键感到困惑.

I am confused between Primary and Unique Key.

我知道主键不允许 NULL,而 Unique 会接受 NULL.此外,一个表可以有n"个唯一键..!

I am aware that Primary Key will not allow NULL, while Unique will accept NULL. Also, a table can have 'n' number of unique keys ..!

主键是否允许零?

推荐答案

Primary Key 可以为零,但如果您在列上设置 Identity,它通常会从 1 开始,而不是从零开始.

Primary Key Can be Zero, but if you set Identity on the column it normally will start at 1 rather than Zero.

这篇关于SQL 主键可以接受'0'吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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