130 likes | 248 Views
Exam 2 Review: SQL In, Dimensional Modeling, Pivot Tables, ETL. Describe data cube elements Understand facts, dimensions, granularity Create/read a Star Schema How to clean data. ETL in Excel. Take up the Assignment Solutions…. Create a Table. CREATE TABLE `m1orderdb`.`Customer` (
E N D
Exam 2 Review:SQL In, Dimensional Modeling, Pivot Tables, ETL Describe data cube elements Understand facts, dimensions, granularity Create/read a Star Schema How to clean data
ETL in Excel • Take up the Assignment Solutions…
Create a Table CREATE TABLE `m1orderdb`.`Customer` ( `CustomerID` INT NOT NULL ,`FirstName` VARCHAR(45) NULL , `LastName` VARCHAR(45) NULL , `City` VARCHAR(45) NULL , `State` VARCHAR(2) NULL , `Zip` VARCHAR(10) NULL , PRIMARY KEY (`CustomerID`) );
Changing a Table’s Structure ALTER TABLE customerADDSkypeID VARCHAR(15) ALTER TABLE customer DROP COLUMN SkypeID ALTER TABLE customer CHANGE COLUMN SkypeIDSkypeID_NEW VARCHAR(15)
Insert a New Row INSERT INTO `m1orderdb`.`Customer` (`CustomerID`, `FirstName`, `LastName`, `City`, `State`, `Zip`) VALUES (1005, 'Chris', 'Taub', 'Princeton', 'NJ', '09120'); Note that field names are surrounded by “back quotes” (`) and string field values are surrounded by “regular quotes” (')
Change a Row (UPDATE) UPDATE `m1orderdb`.`Product` SET ProductName='Honey Nut Cheerios', Price=4.50 WHERE ProductID=2251 Product
DELETE example • DELETE FROM `m1orderdb`.`Customer` WHERE `CustomerID`=1004
The Data Cube • Dimensions (Top Selling Products) • Fill in 3 reasonable values • What’s the fact? • Slice the Data? • Granularity? _______ _____ __________
_______ _____ __________
The Star Schema • Draw our Star Schema, from the Cube.
Pivot Tables • You need to know these too!