Download presentation
Presentation is loading. Please wait.
Published byJudith Ruth Gibson Modified over 8 years ago
1
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
2
ETL in Excel Take up the Assignment Solutions…
3
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`) ); Customer CustomerID FirstName LastName City State Zip
4
Data types Data typeDescriptionExamples INTInteger3, -10 DECIMAL(n,n)Decimal3.23, 3.14159 VARCHAR(n)String (numbers and letters)Hello, I like pizza, MySQL! DATETIMEDate/Time (or just date)2011-09-01 17:35:00, 2011-04-12 BOOLEANBoolean value0 or 1
5
Changing a Table’s Structure ALTER TABLE customer ADD SkypeID VARCHAR(15) ALTER TABLE customer DROP COLUMN SkypeID ALTER TABLE customer CHANGE COLUMN SkypeID SkypeID_NEW VARCHAR(15)
6
Insert a New Row INSERT INTO `m1orderdb`.`Customer` (`CustomerID`, `FirstName`, `LastName`, `City`, `State`, `Zip`) VALUES (1005, 'Chris', 'Taub', 'Princeton', 'NJ', '09120'); CustomerIDFirstNameLastNameCityStateZip 1001GregHousePrincetonNJ09120 1002LisaCuddyPlainsboroNJ09123 1003JamesWilsonPittsgroveNJ09121 1004EricForemanWarminsterPA19111 1005ChrisTaubPrincetonNJ09120 Note that field names are surrounded by “back quotes” (`) and string field values are surrounded by “regular quotes” (')
7
Change a Row (UPDATE) UPDATE `m1orderdb`.`Product` SET ProductName='Honey Nut Cheerios', Price=4.50 WHERE ProductID=2251 ProductIDProductNamePrice 2251Cheerios3.99 2282Bananas1.29 2505Eggo Waffles2.99 Product ProductIDProductNamePrice 2251Honey Nut Cheerios 4.50 2282Bananas1.29 2505Eggo Waffles2.99
8
DELETE example DELETE FROM `m1orderdb`.`Customer` WHERE `CustomerID`=1004 CustomerIDFirstNameLastNameCityStateZip 1001GregHousePrincetonNJ09120 1002LisaCuddyPlainsboroNJ09123 1003JamesWilsonPittsgroveNJ09121 1004EricForemanWarminsterPA19111 CustomerIDFirstNameLastNameCityStateZip 1001GregHousePrincetonNJ09120 1002LisaCuddyPlainsboroNJ09123 1003JamesWilsonPittsgroveNJ09121
10
The Data Cube _______ _____ Dimensions (Top Selling Products) – Fill in 3 reasonable values – What’s the fact? Slice the Data? Granularity? __________
11
_______ _____ __________
12
The Star Schema Draw our Star Schema, from the Cube.
13
Pivot Tables You need to know these too!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.