比较不常见不成逻辑的sql语句

1 select o_orderpriority from orders where o_orderdate >= date '1993-07-01' and exists(select * from lineitem where l_orderkey = o_orderkey and l_commitdate < l_receiptdate),exists嵌套语句的查询语句中lineitem表中不包含o_orderkey字段.

2 select * from ORDERS where o_orderdate >= date '1993-07-01'

3 select * from ORDERS where o_orderdate < date '1993-07-01' + interval '3' month(day/year/hour/minute)

4 select extract(year from l_shipdate) as l_year from lineitem

5 select l_shipdate from lineitem where l_shipdate between date '1995-01-01' and date '1996-12-31'

6 select sum(case when n_name = 'RUSSIA' then 12 else 0 end) / sum(N_REGIONKEY) as mkt_share from nation

7 select p_name from part where p_name like '%blanched%' 

8 select substring(c_phone from 1 for 2) as cntrycode from customer // 电话号码的尾号

9 select COALESCE(cr_return_quantity,0) AS sales_cnt from CATALOG_RETURNS

10 select * from CALL_CENTER where CAST(CC_GMT_OFFSET AS DECIMAL(17,2))/CAST(CC_TAX_PERCENTAGE AS DECIMAL(17,2)) < 0.9

11 select cast('1999-08-25' as date) + 30 from dual

12 with inv as (select * from ) CALL_CENTER

13 select substr(ca_zip,1,5) as subcazip, substr(s_zip,1,5) as subszip from CUSTOMER_ADDRESS,STORE where substr(ca_zip,1,5) = substr(s_zip,1,5) 

14 select round(SS_NET_PAID_INC_TAX/(coalesce(SS_QUANTITY,1)),2) ratio from STORE_SALES

15



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值