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;
Below is the star schema of the given relational schema. It consist of 9 dimensions and 1 fact table.

Utilize the JigSaw SQL file below to create a Star Schema diagram. Remember, to create a...
Write a single SQL statement to create a new playlist called 'Background music'; and write another single SQL statement to associate the new playlist with the 10 longest duration tracks of jazz music from the Track table. CREATE TABLE MediaType ( MediaTypeID INTEGER PRIMARY KEY NOT NULL, Name TEXT ); CREATE TABLE Playlist ( PlaylistID INTEGER PRIMARY KEY NOT NULL, Name TEXT ); CREATE TABLE PlaylistTrack ( PlaylistID INTEGER NOT NULL, TrackID INTEGER NOT NULL, PRIMARY KEY (PlaylistID, TrackID), FOREIGN...
SQL CHECK CONSTRAINT AND TEST CASE... SQL Query Here are the tables: CREATE TABLE Movies( movieID INT, name VARCHAR(30) NOT NULL, year INT, rating CHAR(1), length INT, totalEarned NUMERIC(7,2), PRIMARY KEY(movieID), UNIQUE(name, year) ); CREATE TABLE Showings( theaterID INT, showingDate DATE, startTime TIME, movieID INT, priceCode CHAR(1), PRIMARY KEY(theaterID, showingDate, startTime), FOREIGN KEY(theaterID) REFERENCES Theaters, FOREIGN KEY(movieID) REFERENCES Movies ); CREATE TABLE Tickets( theaterID INT, seatNum INT, showingDate DATE, startTime TIME, customerID INT, ticketPrice NUMERIC(4,2), PRIMARY KEY(theaterID, seatNum, showingDate, startTime)...
-- 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. 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...
CREATE TABLE person ( pid INTEGER NOT NULL ,pname VARCHAR(30) NOT NULL ,PRIMARY KEY (pid) ); CREATE TABLE organization ( oid INTEGER NOT NULL ,oname VARCHAR(30) NOT NULL ,PRIMARY KEY (oid) ); CREATE TABLE venue ( vid INTEGER NOT NULL ,area CHAR(1) NOT NULL ,capacity INTEGER NOT NULL ,PRIMARY KEY (vid) ); CREATE TABLE calendar ( vid INTEGER NOT NULL ,date DATE NOT NULL ,price NUMERIC(6,2) NOT NULL ,PRIMARY KEY(vid,date) ,FOREIGN KEY(vid) REFERENCES venue(vid) ); CREATE TABLE event ( eid...
CREATE TABLE GLAccounts ( AccountNo INT, AccountDescription VARCHAR(50), -- CONSTRAINT GLAccounts_PK PRIMARY KEY(AccountNo), -- CONSTRAINT AccountDescription_NULL CHECK(AccountDescription IS NOT NULL), -- CONSTRAINT AccountDescription_Zero_LEN CHECK(LEN(AccountDescription)>0) ); GO ----------------------------------------------------------------------------- CREATE TABLE Terms ( TermsID INT, TermsDescription VARCHAR(50), TermsDueDays SMALLINT, -- CONSTRAINT PK_Terms PRIMARY KEY(TermsID), -- CONSTRAINT TermsDescription_NULL CHECK(TermsDescription IS NOT NULL), CONSTRAINT TermsDueDays_NULL CHECK(TermsDueDays IS NOT NULL), -- CONSTRAINT TermsDescription_zero_LEN ...
Create a new database and execute the code below in SQL Server’s query window to create the database tables. CREATE TABLE PhysicianSpecialties (SpecialtyID integer, SpecialtyName varchar(50), CONSTRAINT PK_PhysicianSpecialties PRIMARY KEY (SpecialtyID)) go CREATE TABLE ZipCodes (ZipCode varchar(10), City varchar(50), State varchar(2), CONSTRAINT PK_ZipCodes PRIMARY KEY (ZipCode)) go CREATE TABLE PhysicianPractices (PracticeID integer, PracticeName varchar(50), Address_Line1 varchar(50), Address_Line2 varchar(50), ZipCode varchar(10), Phone varchar(14), Fax varchar(14), WebsiteURL varchar(50), CONSTRAINT PK_PhysicianPractices PRIMARY KEY (PracticeID), CONSTRAINT FK_PhysicianPractices_ZipCodes FOREIGN KEY (ZipCode) REFERENCES Zipcodes) go CREATE...
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 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, 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,...