SQL 编码规范 参考Sql Server 1 书写格式 1
1 存储过程SQL 文书写格式例 select c
dealerCode, round(sum(c
submitSubletAmountDLR + c
submitPartsAmountDLR + c
submitLaborAmountDLR) / count(*), 2) as avg, decode(null, 'x', 'xx', 'CNY') from ( select a
dealerCode, a
submitSubletAmountDLR, a
submitPartsAmountDLR, a
submitLaborAmountDLR from SRV_TWC_F a where (to_char(a
ORIGSUBMITTIME, 'yyyy/mm/dd') >= 'Date Range(start)' and to_char(a
ORIGSUBMITTIME, 'yyyy/mm/dd') = 'Date Range(start)' and to_char(b
ORIGSUBMITTIME,'yyyy/mm/dd')
Select/From/Where/Order by /Grou p by 等子句必须另其一行写 2>
Select 子句内容如果只有一项,与 Select 同行写 3>
Select 子句内容如果多于一项,每一项单独占一行,在对应 Select 的基础上向右缩