Question

Utilize the JigSaw SQL file below to create a Star Schema diagram. Remember, to create a...

Utilize the JigSaw SQL file below to create a Star Schema diagram. Remember, to create a Star Schema from a normalized data model, you will need to denormalize the data model into fact and dimension tables.

The diagram should contain all of the facts and dimension tables necessary to integrate the JigSaw operational database into a data warehouse. Write a brief paper describing the challenges you experienced in completing this assignment.

-- CREATE DATABASE js;

CREATE TABLE buy_methods (
buy_code CHAR(4) NOT NULL,
buy_desc CHAR(25) NOT NULL,
PRIMARY KEY (buy_code)
);

-- ALTER TABLE buy_methods COMMENT 'store, internet, TE.';


CREATE TABLE payment_methods (
pay_code CHAR(4) NOT NULL,
pay_desc CHAR(25) NOT NULL,
PRIMARY KEY (pay_code)
);

-- ALTER TABLE payment_methods COMMENT 'method of payment: cash, credit card, check.';


CREATE TABLE countries (
cou_id smallint NOT NULL,
country_name CHAR(30) NOT NULL,
PRIMARY KEY (cou_id)
);

-- ALTER TABLE countries COMMENT '';


CREATE TABLE cities (
city_id integer NOT NULL,
city_name CHAR(30) NOT NULL,
cou_id smallint NOT NULL,
PRIMARY KEY (city_id)
);

-- ALTER TABLE cities COMMENT '';


CREATE TABLE customers (
cus_id integer NOT NULL,
cus_name CHAR(30) NOT NULL,
cus_lastname CHAR(30) NOT NULL,
add_street CHAR(50),
add_zipcode CHAR(10),
city_id integer NOT NULL,
PRIMARY KEY (cus_id)
);

-- ALTER TABLE customers COMMENT '';


CREATE TABLE invoices (
invoice_number integer NOT NULL,
buy_code CHAR(4) NOT NULL,
inv_date DATE NOT NULL,
pay_code CHAR(4) NOT NULL,
inv_price NUMERIC(8,2) DEFAULT 0 NOT NULL,
cus_id integer NOT NULL,
PRIMARY KEY (invoice_number)
);

-- ALTER TABLE invoices COMMENT '';


CREATE TABLE manufacturers (
man_code CHAR(3) NOT NULL,
man_desc CHAR(25) NOT NULL,
PRIMARY KEY (man_code)
);

-- ALTER TABLE manufacturers COMMENT 'Puzzle Manufacturers';


CREATE TABLE products (
pro_code CHAR(8) NOT NULL,
man_code CHAR(3) NOT NULL,
pro_name CHAR(35) NOT NULL,
pro_description CHAR(100),
pro_type CHAR(10) DEFAULT 'PUZZLE' NOT NULL,
pro_theme CHAR(50),
pro_pieces integer,
pro_packaging CHAR(20),
pro_shape CHAR(20),
pro_style CHAR(20),
pro_buy_price NUMERIC(6,2) DEFAULT 0 NOT NULL,
pro_sel_price NUMERIC(6,2) DEFAULT 0 NOT NULL,
pro_stock integer DEFAULT 0 NOT NULL,
pro_stock_min integer DEFAULT 0 NOT NULL,
pro_stock_max integer DEFAULT 0 NOT NULL,
PRIMARY KEY (pro_code, man_code)
);

-- ALTER TABLE products COMMENT 'Products (Puzzles & Accesories)';


CREATE TABLE invoices_detail (
invoice_number integer NOT NULL,
linenr smallint NOT NULL,
pro_code CHAR(8) NOT NULL,
man_code CHAR(3) NOT NULL,
cant_prod smallint NOT NULL,
price_unit NUMERIC(6,2) NOT NULL,
price NUMERIC(8,2) NOT NULL,
PRIMARY KEY (invoice_number, linenr)
);

-- ALTER TABLE invoices_detail COMMENT '';


ALTER TABLE invoices ADD CONSTRAINT buy_place_invoices_fk
FOREIGN KEY (buy_code)
REFERENCES buy_methods (buy_code)
ON DELETE NO ACTION
ON UPDATE NO ACTION;

ALTER TABLE invoices ADD CONSTRAINT payment_methods_invoices_fk
FOREIGN KEY (pay_code)
REFERENCES payment_methods (pay_code)
ON DELETE NO ACTION
ON UPDATE NO ACTION;

ALTER TABLE cities ADD CONSTRAINT countries_cities_fk
FOREIGN KEY (cou_id)
REFERENCES countries (cou_id)
ON DELETE NO ACTION
ON UPDATE NO ACTION;

ALTER TABLE customers ADD CONSTRAINT cities_clients_fk
FOREIGN KEY (city_id)
REFERENCES cities (city_id)
ON DELETE NO ACTION
ON UPDATE NO ACTION;

ALTER TABLE invoices ADD CONSTRAINT clients_invoices_fk
FOREIGN KEY (cus_id)
REFERENCES customers (cus_id)
ON DELETE NO ACTION
ON UPDATE NO ACTION;

ALTER TABLE invoices_detail ADD CONSTRAINT invoices_invoices_detail_fk
FOREIGN KEY (invoice_number)
REFERENCES invoices (invoice_number)
ON DELETE NO ACTION
ON UPDATE NO ACTION;

ALTER TABLE products ADD CONSTRAINT manufacturers_products_fk
FOREIGN KEY (man_code)
REFERENCES manufacturers (man_code)
ON DELETE NO ACTION
ON UPDATE NO ACTION;

ALTER TABLE invoices_detail ADD CONSTRAINT products_invoices_detail_fk
FOREIGN KEY (pro_code, man_code)
REFERENCES products (pro_code, man_code)
ON DELETE NO ACTION
ON UPDATE NO ACTION;

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Below is the star schema of the given relational schema. It consist of 9 dimensions and 1 fact table.

Add a comment
Know the answer?
Add Answer to:
Utilize the JigSaw SQL file below to create a Star Schema diagram. Remember, to create a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • -- Schema definition create table Customer (     cid   smallint not null,     name varchar(20),    ...

    -- Schema definition create table Customer (     cid   smallint not null,     name varchar(20),     city varchar(15),     constraint customer_pk         primary key (cid) ); create table Club (     club varchar(15) not null,     desc varchar(50),     constraint club_pk         primary key (club) ); create table Member (     club varchar(15) not null,     cid   smallint     not null,     constraint member_pk         primary key (club, cid),     constraint mem_fk_club         foreign key (club) references Club,     constraint mem_fk_cust...

  • /* I am executing following SQL statement for the below code but I am getting error....

    /* I am executing following SQL statement for the below code but I am getting error. Pls, upload screenshot after running it. SQL Statement: SELECT OfferNo, CourseNo FROM Offering WHERE OfferTerm = 'Sum' AND OfferYear = 2012 AND FacSSN IS NULL; */ CREATE TABLE STUDENT( StdSSN INT NOT NULL PRIMARY KEY, StdFName VARCHAR2(50), StdLName VARCHAR2(50), StdCity VARCHAR2(50), StdState VARCHAR2(2), StdZip VARCHAR2(10), StdMajor VARCHAR2(15), StdYear VARCHAR2(20) ); CREATE TABLE FACULTY( FacSSN INTEGER NOT NULL PRIMARY KEY, FacFName VARCHAR(50), FacLName VARCHAR(50), FacCity...

  • NEED HELP IN INSERT STATEMENTS FOR THE TABLES CAN YOU PLEASE ADD SOME INSERT STATEMENTS FOR...

    NEED HELP IN INSERT STATEMENTS FOR THE TABLES CAN YOU PLEASE ADD SOME INSERT STATEMENTS FOR A COMPANY SCHEMA SCRIPT. PLEASE ADN THANK YOU DROP TABLE dependent; DROP TABLE works_on; DROP TABLE project; DROP TABLE dept_locations; DROP TABLE department; DROP TABLE employee; CREATE TABLE employee ( fname varchar(15) not null, minit varchar(1), lname varchar(15) not null, ssn char(9), bdate date, address varchar(50), sex char, salary numeric(10,2), superssn char(9), dno numeric, primary key (ssn), foreign key (superssn) references employee(ssn) ); CREATE...

  • SQL Query Question: I have a database with the tables below, data has also been aded...

    SQL Query Question: I have a database with the tables below, data has also been aded into these tables, I have 2 tasks: 1. Add a column to a relational table POSITIONS to store information about the total number of skills needed by each advertised position. A name of the column is up to you. Assume that no more than 9 skills are needed for each position. Next, use a single UPDATE statement to set the values in the new...

  • SQL Command - Create a view called S LIST that lists the Cardholder Number, last name,...

    SQL Command - Create a view called S LIST that lists the Cardholder Number, last name, first name and due date for all cardholders who have not returned a book. Use the CREATE OR REPLACE VIEW AS ... command. TABLE CARD HOLDERS Cardholder Numberint NOT NULL CONSTRAINT CH PK PRIMARY KEY, First_Name varchar(10) NULL, LastName varchar(15) NULL, Address varchar(20) NULL, varchar(15) NULL, State char(2) NULL, Zip_Code char(5) NULL) City TABLE BOOKS CHECKED OUT Cardholder_Numberint NOT NULL, Book Numberint NOT NULL,...

  • MICROSOFT SQL SERVER - Create the following views 1.List the employee assigned to the most projects...

    MICROSOFT SQL SERVER - Create the following views 1.List the employee assigned to the most projects 2.List the project with the most hours SCRIPT TO BUILD DATABASE create table department ( dept_ID int not null , dept_name char(50) NOT NULL, manager_ID int not null, manager_start_date date not null, constraint Dept_PK primary key (dept_ID), constraint D_Name_AK unique (dept_name) ); insert into department values(1,'abc',1,'2019-01-08'); insert into department values(2,'abc2',2,'2019-01-08'); insert into department values(3,'abc3',2,'2019-01-08'); insert into department values(4,'abc4',2,'2019-01-08'); /*project table done*/ create table project...

  • Someone Please Help Me modify this in PHP I'm in desperate need I cant figure this out ... Make t...

    Someone Please Help Me modify this in PHP I'm in desperate need I cant figure this out ... Make the following modifications: For the vendors table: Comment out the table-level primary key Change the VendorIDcolumn to be a column-level primary key Add a VendorEmail column to the bottom of the table definition (define the data type for the column as variable character and set it to not exceed 45 characters) After the lineItems table, add code to create a table...

  • Using SQL and the following info Question 3: Find the people who do not have Viper...

    Using SQL and the following info Question 3: Find the people who do not have Viper Certification but are still assigned to Viper class ship Find the fname, lname, and ship_instance_id for all people who do not have Viper certification but are assigned to at least one instance of a Viper class ship (this includes all variants of Viper class ships). Return a row for every ship/person combination. Order your results by fname in ascending order. Use the BSG database...

  • Using SQL and the following info Question 3: Find the people who do not have Viper...

    Using SQL and the following info Question 3: Find the people who do not have Viper Certification but are still assigned to Viper class ship Find the fname, lname, and ship_instance_id for all people who do not have Viper certification but are assigned to at least one instance of a Viper class ship (this includes all variants of Viper class ships). Return a row for every ship/person combination. Order your results by fname in ascending order. Use the BSG database...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT