The createdw.sql file

This file creates the new sales_demo database with logging and then creates tables within that database. It contains the following statements:
create database sales_demo with log;

create table product (
   product_code integer,
   product_name char(31),
   vendor_code char(3),
   vendor_name char(15),
   product_line_code smallint,
   product_line_name char(15));

create table customer (
   customer_code integer,
   customer_name char(31),
   company_name char(20));


create table sales (
   customer_code integer,
   district_code smallint,
   time_code integer,
   product_code integer,
   units_sold smallint,
   revenue money (8,2),
   cost money (8,2),
   net_profit money(8,2)); 

create table time
   (
   time_code int,
   order_date date,
   month_code smallint,
   month_name char(10),
   quarter_code smallint,
   quarter_name char(10),
   year integer
   );

create table geography (
    district_code serial,
   district_name char(15),
   state_code char(2),
   state_name char(18),
   region smallint);

Copyright© 2019 HCL Technologies Limited