分类: Oracle
2015-03-19 23:40:54
SQL> create table SALES(prod_id number not null,CUST_ID number not null,time_id date not null,channel_id number not null,promo_id number not null,quantity number(10,2) not null);
SQL> CREATE VIEW v3 AS SELECT * FROM SALES WHERE cust_id=2034 WITH CHECK OPTION;
View created.
SQL> CREATE VIEW v1 AS SELECT * FROM SALES WHERE time_id<=SYSDATE - 2*365 WITH CHECK OPTION;
View created.
C答案其他列不能为空
D答案sum(quantity_sold)后面需要加别名
SQL> create view v4 as select prod_id,cust_id,sum(quantity_SOLD) sumqty from sales where time_id<=sysdate-2*365 group by prod_id,cust_id with check option;
View created.