Building a Time Dimension Copyright © 2001 by Michael A. Mina.

Slides:



Advertisements
Similar presentations
Saving lives, changing minds. Vietnam Red Cross Society – DRT WatSan Training Nepal Red Cross Society - NDRT WatSan Training OPERATIONAL CALCULATIONS.
Advertisements

Database Relationships in Access As you recall, the data in a database is stored in tables. In a relational database like Access, you can have multiple.
Advanced SQL Topics Edward Wu.
1 Copyright © 2009, Oracle. All rights reserved. B Table Descriptions.
Creating Flash without Flash A brief introduction to Anim-FX by Michael Mina.
4-2 Warm Up Problem of the Day Lesson Presentation
Preview Warm Up California Standards Lesson Presentation.
Divisibility tests These are simple tricks to test what a number can be shared by. We are going to learn tricks for testing if a number can be shared by.
Practice for SQL and Constraints (Product-PC-Laptop-Printer)
Examples of Physical Query Plan Alternatives
Introduction to SQL Tuning Brown Bag Three essential concepts.
Chapter 4 Joining Multiple Tables
Session 2Introduction to Database Technology Data Types and Table Creation.
A Guide to SQL, Seventh Edition. Objectives Use joins to retrieve data from more than one table Use the IN and EXISTS operators to query multiple tables.
Complex Integrity Constraints in SQL. Constraints over a Single Table Table Constraint: Create TABLE Sailors (sid INTEGER, sname CHAR(10), rating INTEGER,
SQL - Subqueries and Schema Chapter 3.4 V3.0 Napier University Dr Gordon Russell.
 Which number is in exponential form: -10,, 10  Identify the Base of that number  What is the exponent in that number? - the number being multiplied.
SQL Rohit Khokher.
4.1 Powers of 10.
X-and Y-intercepts. Standard Form (of a linear equation) ax + by = c, where a, b, and c are integers.
Dividing by 10, 100 and 1,000 Created by: Sabrina Edmondson Adapted from BBC online 6.3.
Another Presentation © All Rights Reserved.
Another Presentation © All Rights Reserved.
Count to 20. Count reliably at least 10 objects. Use ‘more’ and ‘less’ to compare two numbers. Count reliably at least 10 objects. Estimate number of objects.
Database Basics I101 Summer 2006 Copyright 2004, Matt Hottell.
Dimensional Modeling Business Intelligence Solutions.
Structured Query Language - SQL Carol Wolf Computer Science.
Fall 2001Arthur Keller – CS 1808–1 Schedule Today Oct. 18 (TH) Schemas, Views. u Read Sections u Project Part 3 extended to Oct. 23 (T). Oct.
Winter 2002Arthur Keller – CS 1808–1 Schedule Today: Jan. 29 (T) u Modifications, Schemas, Views. u Read Sections Assignment 3 due. Jan. 31 (TH)
Murali Mani SQL DDL and Oracle utilities. Murali Mani Datatypes in SQL INT (or) INTEGER FLOAT (or) REAL DECIMAL (n, m) CHAR (n) VARCHAR (n) DATE, TIME.
Concepts of Database Management, 4th Edition, Pratt & Adamski
Structured Query Language (SQL) A2 Teacher Up skilling LECTURE 2.
Holliday - COEN 1781 Introduction to SQL. Holliday - COEN 1782 DB Tables and SQL The data is stored in the database in relations or tables Data types.
ZEIT2301 Design of Information Systems SQL: Creating a Database School of Engineering and Information Technology Dr Kathryn Merrick.
1 Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall. Access Module 1 Workshop 1 The Four Main Database Objects Series Editor Amy Kinser.
Constraints  Constraints are used to enforce rules at table level.  Constraints prevent the deletion of a table if there is dependencies.  The following.
Winter 2006Keller Ullman Cushing8–1 Turning in Assignments Please turn in hard copy (use only in the direst of circumstances). I am not your secretary.
Lecture 2 of Advanced Databases Advanced SQL Instructor: Mr.Ahmed Al Astal.
Chapter 9 Joining Data from Multiple Tables
POWNALL GREEN PRIMARY SCHOOL HELPING YOUR CHILD WITH MULTIPLICATION TABLES.
Dr Gordon Russell, Napier University Unit SQL 2 - V2.0 1 SQL 2 Unit 1.3.
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
CS146 References: ORACLE 9i PROGRAMMING A Primer Rajshekhar Sunderraman
Chapter 4Introduction to Oracle9i: SQL1 Chapter 4 Joining Multiple Tables.
SCUHolliday - coen 1788–1 Schedule Today u Modifications, Schemas, Views. u Read Sections (except and 6.6.6) Next u Constraints. u Read.
RDBMS MySQL. MySQL is a Relational Database Management System MySQL allows multiple tables to be related to each other. Similar to a Grandparent to a.
1 DBS201: More on SQL Lecture 3. 2 Agenda How to use SQL to update table definitions How to update data in a table How to join tables together.
Concepts of Database Management Seventh Edition Chapter 3 The Relational Model 2: SQL.
Centre of Competence on data warehouse Workshop Helsinki Database Cube and Browsing the Cube Mark Rantala.
* Database is a group of related objects * Objects can be Tables, Forms, Queries or Reports * All data reside in Tables * A Row in a Table is a record.
Chapter 4 Relational Database, Pivot Charts, and Switchboard.
N-ary Relations & Their Applications. 2 n-ary Relations Let A 1, A 2, …, A n be sets. An n-ary relation on these sets is a subset of A 1 x A 2 x … x A.
NR 322: Editing Attributes Jim Graham Fall 2008 Chapter 6.
1 CPE 332 Introduction DBMS: Relational Database Managment Systems Instructor:Suthep Madarasmi, Ph.D. ดร. สุเทพ มาดารัศมี
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
 MySQL  DDL ◦ Create ◦ Alter  DML ◦ Insert ◦ Select ◦ Update ◦ Delete  DDL(again) ◦ Drop ◦ Truncate.
Introduction to Databases & SQL Ahmet Sacan. What you’ll need Firefox, SQLite plugin Mirdb and Targetscan databases.
DAY 20: ACCESS CHAPTERS 5, 6, 7 Larry Reaves October 28,
Creating Database Objects
Databases.
Unary Many-to-Many Relationship
Two-Dimensional Arrays
MySQL Explain examples
Microsoft Access 2003 Illustrated Complete
Introduction to SQL Holliday - COEN 178.
Tests of Divisibility 1 - All integers can be divided by 1
Name _________________________ Date _______________
Database SQL.
Creating Database Objects
SQL (Structured Query Language)
Presentation transcript:

Building a Time Dimension Copyright © 2001 by Michael A. Mina

2 Create (manually or otherwise) one table listing the digits 0 through 9.

Copyright © 2001 by Michael A. Mina3 SELECT 1000*A.Digit+100*B.Digit+10*C.Digit+D.Digit AS DateKey, DateAdd("d",1000*A.Digit+100*B.Digit+10*C.Digit+D.Digit,#01/01/1 990#) AS DateValue INTO DateValues FROM Digits AS A, Digits AS B, Digits AS C, Digits AS D ORDER BY 1; Write a cross join query to create a Cartesian product of the table with itself four times. Our SELECT statement will use the Cartesian product to create the integers 0 through 10,000. The DateAdd function will add these integers to a starting date (in this case, 1/1/1990). Different databases may use a different function to add integers to dates.

Copyright © 2001 by Michael A. Mina4

5 SELECT DateKey, DateValue, Day(DateValue) AS Day, Month(DateValue) AS Month, Int((Month(DateValue)+2)/3) AS Quarter, Year(DateValue) AS Year INTO TimeDimension FROM DateValues; Create a Time dimension table using the previous table. Use the row functions provided by your database to add the information you need. Remember to create a primary key on the Time dimension table.

Copyright © 2001 by Michael A. Mina6