impala临时表概念
- 作者: 萌萌萌小可爱
- 来源: 51数据库
- 2020-09-30
WITH是CTE(公共表达式)的语法,它是逻辑概念而非物理实体。--类似于一个临时View
而临时表时物理存在的实体。
所以,二者的差别,某种程度上,相当于View与Table间的差别。
select 'price category' =
case
when price is null then 'not yet priced'
when price < 10="" then="" 'very="" reasonable="" title'="" when="" price="">= 10 and price < 20="" then="" 'coffee="" table="" title'="" else="" 'expensive="" book!'="" end="" 先说下,case要和end一块用。="" 从上面可以看出,case里用的是when="" then="" 形式,从整个case="" end来看,它是从自己的多个语句中择一输出结果。="" 如果是把when="" 看成if="" ,就好理解多了,if语句就像是筛子里的石子,而case="">
而临时表时物理存在的实体。
所以,二者的差别,某种程度上,相当于View与Table间的差别。
select 'price category' =
case
when price is null then 'not yet priced'
when price < 10="" then="" 'very="" reasonable="" title'="" when="" price="">= 10 and price < 20="" then="" 'coffee="" table="" title'="" else="" 'expensive="" book!'="" end="" 先说下,case要和end一块用。="" 从上面可以看出,case里用的是when="" then="" 形式,从整个case="" end来看,它是从自己的多个语句中择一输出结果。="" 如果是把when="" 看成if="" ,就好理解多了,if语句就像是筛子里的石子,而case="">
推荐阅读
