1)
create or replace view view1
(
aa,
b,
c) as
select
a,
b,
c
from table1 with read only;2)
create or replace view view1 as
select
a as aa
b,
c
from table1 with read only;哪种写法建立出的视图更好呢?
create or replace view view1
(
aa,
b,
c) as
select
a,
b,
c
from table1 with read only;2)
create or replace view view1 as
select
a as aa
b,
c
from table1 with read only;哪种写法建立出的视图更好呢?
第二个要达成第一个的效果要加列别名,比如select a as aa
仅此而已
实际查询的时候,还是把视图的语句拿到sql语句中去的。
比如你这里select × from view1 where b=1,其实执行的时候,还是select a,b,c from table1 where b=1。效率上没有任何提高
用第一种方法吧,当你的视图有统计功能的时候,
也就是说,select count(*),a+b+c from tab这种时候,列名就不方便显示,自己命命为合适的名字,比较易看易懂