Then indaytype weekend else indaytype weekday end if

This preview shows page 2 - 3 out of 3 pages.

THEN in_Day_Type := 'Weekend';ELSE in_Day_Type := 'Weekday';END IF;INSERT INTO TIMES(Sale_Day, Day_Type)VALUES(i.Sale_Date, in_Day_Type);END LOOP;END;/SELECT day_type, COUNT(*),MIN(sale_day),MAX(sale_day) FROM times GROUP BY day_type ORDER BY day_type;DROP TABLE sales_facts CASCADE CONSTRAINTS; CREATE TABLE sales_facts(sf_ID varchar2(50),sale_day date NOT NULL,vehicle_code number(5,0)NOT NULL,plan_ID number(5,0)NOT NULL,dealer_ID number(5,0)NOT NULL,vehicles_sold number(8),gross_sales_amount number(10),CONSTRAINT sales_facts_sfID_pk PRIMARY KEY(sale_day,vehicle_code,plan_ID, dealer_ID),CONSTRAINT times_sale_day_fk FOREIGN KEY(sale_day) REFERENCES times(sale_day),CONSTRAINT vehicles_vehicle_code_fk FOREIGN KEY(vehicle_code) REFERENCES vehicles (vehicle_code),CONSTRAINT plans_sfplanID_fk FOREIGN KEY(plan_ID) REFERENCES plans (plan_ID),
CONSTRAINT dealerships_dealerID_fk FOREIGN KEY(dealer_ID) REFERENCES dealerships (dealer_ID));DESCRIBE sales_facts;set echo offspool off

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture