Oracle:从表中创建具有少量不同数据的视图

时间:2013-12-26 07:04:12

标签: sql database oracle view

我有Table Book,数据是:

BookID   Name   Type
------  ------  -----
  1       A      null
  2       B      null

如何从表格View中创建一个视图名称[BookList],如下所示:

Name   Type
----   ----
 A     Thin
 B     Thick

1 个答案:

答案 0 :(得分:2)

将视图BookList创建为

select name,

type = case when name = 'A' then 'thin'

            when name = 'B' then 'thick'
            end
from book