为什么我应该大写我的SQL关键字? [英] Why should I capitalize my SQL keywords?

查看:148
本文介绍了为什么我应该大写我的SQL关键字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

简单的问题。我个人发现一串小写字符比一串大写字符更可读。是一些旧的/流行的SQL的大小写敏感的东西吗?

Simple question. I personally find a string of lowercase characters to be more readable than a string of uppercase characters. Is some old/popular flavor of SQL case-sensitive or something?

参考:

For reference:

select
    this.Column1,
    case when this.Column2 is null then 0 else this.Column2 end
from dbo.SomeTable this
    inner join dbo.AnotherTable another on this.id = another.id
where
    this.Price > 100

vs。

vs.

SELECT
    this.Column1,
    CASE WHEN this.Column2 IS NULL THEN 0 ELSE this.Column2 END
FROM dbo.SomeTable this
    INNER JOIN dbo.AnotherTable another ON this.id = another.id
WHERE
    this.Price > 100

前者似乎对我来说更具可读性,但我更频繁地看到后者。

The former just seems so much more readable to me, but I see the latter way more often.

推荐答案

我认为后者更具可读性。您可以很容易地从表名和列名等分离关键字。

I think the latter is more readable. You can easily separate the keywords from table and column names, etc.

这篇关于为什么我应该大写我的SQL关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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