Академический Документы
Профессиональный Документы
Культура Документы
D. The synonym will be fine, but the view will be invalid. Oracle will attempt to recompile
7.
the view, but this will fail.
A, B, C, E. A is wrong because the view will be invalid. B is wrong because the FORCE
keyword can only be applied when creating a view (and it would still be invalid, even so). C is
wrong because the synonym will be fine. E is wrong because views are not dropped implicitly
(unlike indexes and constraints).
B, C, D. B and C are wrong because a bitmap index can be composite, with columns of
different data types. D is wrong because the bitmap index is not on DEPARTMENT_ID alone,
which would not be possible.
C. It is not possible to change an indexs columns after creation.
13.
A, B, D. B is wrong because the data type is not the problem. A and D are wrong because
an indexs columns are fixed at creation time.
LAB ANSWER
This is a possible solution:
/*create the tables*/
create table sales (sale_id number, channel_id number, product_id number, shop_id number,
day_id number, quantity number);
create table products (product_id number, pname varchar2(20),price number);
create table channels (channel_id number, cname varchar2(20));
create table shops (shop_id number,address varchar2(20));
create table days (day_id number, day date);
/*pre-create indexes to be used for constraints*/
create unique index prod_pk on products(product_id);
create unique index chan_pk on channels(channel_id);
create unique index shop_pk on shops(shop_id);
create unique index day_id on days(day_id);
create unique index sales_pk on sales(sale_id);
/*create bitmap indexes on the dimension columns of the fact table*/
create bitmap index sales_chan on sales(channel_id);
create bitmap index sales_prod on sales(product_id);
create bitmap index sales_shop on sales(shop_id);
create bitmap index sales_date on sales(day_id);
/*add the primary key constraints/*
alter table products add constraint prod_pk primary key (product_id);
alter table channels add constraint chan_pk primary key (channel_id);
alter table shops add constraint shop_pk primary key (shop_id);
alter table days add constraint day_pk primary key (day_id);
alter table sales add constraint sales_pk primary key(sale_id);
/*add the foreign key constraints*/
alter table sales add constraint sales_prod_fk foreign key (product_id) references products;
alter table sales add constraint sales_chan_fk foreign key (channel_id) references channels;
alter table sales add constraint sales_shop_fk foreign key (shop_id) references shops;
alter table sales add constraint sales_day_fk foreign key (day_id) references days;
/*create the sequences for primary keys:
cache many values for the fact table, but don't pre-issue values for the largely static
532 Chapter 12: Creating Other Schema Objects