SQL中的Null,零和Blank有什么区别? [英] What are the differences between Null, Zero and Blank in SQL?

查看:123
本文介绍了SQL中的Null,零和Blank有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释一下吗?

推荐答案

零是一个数字值.它是具有精确的数学性质的定数. (您可以对其进行算术...)

Zero is a number value. It is a definite with precise mathematical properties. (You can do arithmetic on it ...)

NULL表示不存在任何值.除了对其进行测试外,您无法执行任何其他操作.

NULL means the absence of any value. You can't do anything with it except test for it.

空白不明确.它对不同的人在不同的上下文中意味着不同的事物.例如:

Blank is ill-defined. It means different things in different contexts to different people. For example:

  • 某人可能表示长度为零的字符串值:即其中没有字符的字符串('').
  • 有人可能表示一个非零长度的字符串值,该字符串值仅由非打印字符(SPACE,TAB等)组成.或者可能只包含一个空格字符.
  • 在某些情况下(字符和字符串是不同类型),有人可能表示非打印字符值.
  • 有人甚至可能表示在打印或显示时没有出现的任何东西".
  • Someone could mean a zero length string value: i.e. one with no characters in it ('').
  • Someone could mean a non-zero length string value consisting of only non-printing characters (SPACE, TAB, etc). Or maybe consisting of just a single SPACE character.
  • In some contexts (where character and string are different types), someone could mean a non-printing character value.
  • Someone could even mean "anything that doesn't show up when you print or display it".

重点是空白"没有一个明确定义的含义.至少不是(本地)英语IT术语.如果您想让其他IT专业人员理解您的意思,则最好避免这种情况. (如果其他人使用了该术语,但从上下文中看不到该术语,请让他们准确地说出它们的意思!)

The point is that "blank" does not have a single well-defined meaning. At least not in (native) English IT terminology. It is probably best to avoid it ... if you want other IT professionals to understand what you mean. (And if someone else uses the term and it is not obvious from the context, ask them to say precisely what they mean!)

我们不能说任何有关零/空/空白表示方式,它们占用多少内存或类似内容的有意义的信息.我们只能说它们彼此之间的表示方式是不同的....并且实际表示方式是实现和上下文相关.

We cannot say anything generally meaningful about how ZERO / NULL / BLANK are represented, how much memory they occupy or anything like that. All we can say is that they are represented differently to each other .... and that the actual representation is implementation and context dependent.

这篇关于SQL中的Null,零和Blank有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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