drop table product cascade constraints;
create table product (
  pid		number(5),
  pname		varchar2(50),
  category	varchar2(50),
  price		varchar2(50),
  primary key (pid)
);
drop table location cascade constraints;
create table location (
  locid		number(5),
  city		varchar2(50),
  state		varchar2(50),
  country  	varchar2(50),
  primary key (locid)
);
drop table time cascade constraints;
create table time (
  tid		number(10),
  day		number(4),
  month		number(3),
  quarter	number(2),
  year		number(5),
  primary key (tid)
);
drop table sales cascade constraints;
create table sales (
  pid		number(5),
  locid		number(5),
  tid		number(10),
  amount	number(5),
  primary key (pid,locid,tid),
  foreign key (pid) references product,
  foreign key (locid) references location,
  foreign key (tid) references time
);
