avatar
Efficiency difference?# Database - 数据库
s*r
1
Reading some code from other team.
He wrote code in such a way,
case when a='1' then 'N'
when a='2' then 'N'
.....
instead of case when a in ('1','2',....)
No idea whether there is some difference between operation time. Anyone has
idea? Thanks.
avatar
B*g
2
I guess same, hehe.
Better use ****case a when '1' Then 'N' when '2' Then 'N' .... **** if you can

has

【在 s******r 的大作中提到】
: Reading some code from other team.
: He wrote code in such a way,
: case when a='1' then 'N'
: when a='2' then 'N'
: .....
: instead of case when a in ('1','2',....)
: No idea whether there is some difference between operation time. Anyone has
: idea? Thanks.

avatar
s*r
3
Thanks. Really good to know that.

you can

【在 B*****g 的大作中提到】
: I guess same, hehe.
: Better use ****case a when '1' Then 'N' when '2' Then 'N' .... **** if you can
:
: has

avatar
j*n
4
他这么做会比较方便以后的修改。
比如说,需求变了, 当 2 的时候得是 'P'...
他改的时候就很方便。
而且这样的code 读起来要容易。

has

【在 s******r 的大作中提到】
: Reading some code from other team.
: He wrote code in such a way,
: case when a='1' then 'N'
: when a='2' then 'N'
: .....
: instead of case when a in ('1','2',....)
: No idea whether there is some difference between operation time. Anyone has
: idea? Thanks.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。