Database Design 1 CMS 476 Dr. Karl Horak, Instructor.

Post on 11-Jan-2016

222 views 3 download

Tags:

Transcript of Database Design 1 CMS 476 Dr. Karl Horak, Instructor.

Database Design 1Database Design 1

CMS 476CMS 476Dr. Karl Horak, InstructorDr. Karl Horak, Instructor

Session 1Session 1

AdministriviaAdministrivia Course OverviewCourse Overview Week in ReviewWeek in Review Application du JourApplication du Jour Lecture: The Who, What, When, Lecture: The Who, What, When,

Where and Why of DatabasesWhere and Why of Databases Demonstration: Introduction to AccessDemonstration: Introduction to Access ExercisesExercises

Course OverviewCourse Overview

Instructor backgroundInstructor background ExpectationsExpectations of studentsof students Grading Grading Reference material Reference material Organization and presentation Organization and presentation Tools and resourcesTools and resources

Instructor BackgroundInstructor Background

PhD, U of A, 1981PhD, U of A, 1981– Majored in Botany, Ecology, Statistics and Majored in Botany, Ecology, Statistics and

Genetics Genetics – Numerical taxonomy and agricultural statisticsNumerical taxonomy and agricultural statistics

Adjunct Professor, CSF since 1990Adjunct Professor, CSF since 1990 Principle Member of Technical Staff, Principle Member of Technical Staff,

Sandia National LaboratoriesSandia National Laboratories– Cooperative International ProgamsCooperative International Progams– Heavily involved in information managementHeavily involved in information management

—this class is about what I really do every day—this class is about what I really do every day

Current ProjectsCurrent Projects

RPT Image ComparisonRPT Image Comparison Global Engagement websiteGlobal Engagement website Spent nuclear fuel assessment Spent nuclear fuel assessment

surveysurvey Wide-area networking Wide-area networking

technologies for border technologies for border monitoringmonitoring

My ToolsetMy Toolset

SQLSQL AccessAccess VBAVBA PythonPython PlonePlone

The Bottom LineThe Bottom Line

Nice people Nice people Cool projectsCool projects Interesting travelInteresting travel

Expectations of Expectations of StudentsStudents PreparationPreparation AttendanceAttendance ParticipationParticipation HomeworkHomework ExamExam

GradingGrading

Course ActivityCourse Activity % of Grade% of Grade

Homework Homework

(3 @ 20 pts)(3 @ 20 pts)60%60%

Final ExamFinal Exam 30%30%

Class ParticipationClass Participation 10%10%

Reference MaterialReference Material

http://home.comcast.net/~karlhorak/476_SYL.htmhttp://home.comcast.net/~karlhorak/476_SYL.htm http://dir.yahoo.com/Computers_and_Internet/Software/Databases/http://dir.yahoo.com/Computers_and_Internet/Software/Databases/ http://en.wikipedia.org/wiki/Databasehttp://en.wikipedia.org/wiki/Database http://ocw.mit.eduhttp://ocw.mit.edu

(especially http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-830Fall-2005/CourseHome/(especially http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-830Fall-2005/CourseHome/index.htm)index.htm)

or just Google for itor just Google for it

Where’s the Where’s the textbook?!textbook?! At your fingertips …At your fingertips …

Organization and Organization and PresentationPresentation Week in review—databases in real Week in review—databases in real

lifelife Recap—highlights of previous topics Recap—highlights of previous topics

and this week’s podcastand this week’s podcast Application du jour—samples of Application du jour—samples of

databases in actiondatabases in action Tonight’s lecture topicTonight’s lecture topic DemonstrationDemonstration Exercises and Q&AExercises and Q&A

Tools and ResourcesTools and Resources

Access—Access—http://http://office.microsoft.comoffice.microsoft.com/en-us/access/en-us/access

MySQL—MySQL—http://www.mysql.comhttp://www.mysql.com Plone—Plone—http://plone.orghttp://plone.org

Onward…!Onward…!

Week in ReviewWeek in Review

Or, what I did on my summer Or, what I did on my summer vacationvacation

RPT—Access and PythonRPT—Access and Python NEN survey toolNEN survey tool WACSIWACSI MMNAMMNA

Application du JourApplication du Jour

WACSIWACSI– ““Web Access for Civil Society Web Access for Civil Society

Improvements”Improvements”– Middle East Regional activityMiddle East Regional activity– Internet-centered collaborationInternet-centered collaboration– Focused on:Focused on:

Societal improvementsSocietal improvements Economic developmentEconomic development Women’s empowerment Women’s empowerment EducationEducation Religious toleranceReligious tolerance Human rightsHuman rights

– http://unm.wacsi.eduhttp://unm.wacsi.edu

Tonight’s Lecture Tonight’s Lecture Topic:Topic: Who, What, When, Where and Who, What, When, Where and WhyWhy What is a database?What is a database? Why you should care?Why you should care? Who uses databases?Who uses databases? When should you use a database?When should you use a database? Where are the databases?Where are the databases?

What is a Database?What is a Database?

Webster: “a usually large Webster: “a usually large collection of data organized collection of data organized especially for rapid search and especially for rapid search and retrieval (as by a computer)” retrieval (as by a computer)”

Horak: All computerized digital Horak: All computerized digital information is a database, it just information is a database, it just doesn’t know it yet. doesn’t know it yet.

Wherefore and WhyWherefore and Why

Seek and you shall find … well, Seek and you shall find … well, maybemaybe

““If you don’t know what you’re If you don’t know what you’re looking for, you’ll find it.”looking for, you’ll find it.”

““If a piece of data is in a computer If a piece of data is in a computer twice, one of the copies is wrong.”twice, one of the copies is wrong.”

The two R’sThe two R’s– RetrievalRetrieval– RedundancyRedundancy

What is a Database? What is a Database? Part 2Part 2

Types of Databases:Types of Databases: Unstructured (Free-text) Unstructured (Free-text) Flat file (e.g., Excel)Flat file (e.g., Excel) Hierarchical (C:\)Hierarchical (C:\) Relational (Access, MySQL, Relational (Access, MySQL,

Oracle)Oracle) Object-oriented (Zope)Object-oriented (Zope)

Who and When?Who and When?

DBA = Database AdministratorDBA = Database Administrator Anyone with large volumes of Anyone with large volumes of

datadata Anyone with complex questions Anyone with complex questions Everybody needs databases, they Everybody needs databases, they

just don’t know it yetjust don’t know it yet

Where are they? Where are they?

http://www.travelschlepp.comhttp://www.travelschlepp.com prius.xlsprius.xls Your hard driveYour hard drive EFAC.mdbEFAC.mdb http://freeplone2.openia.com/http://freeplone2.openia.com/

mmnammna

Some ExamplesSome Examples

DemonstrationDemonstration

Introduction to MS AccessIntroduction to MS Access EFAC databaseEFAC database TerminologyTerminology

– Tables = spreadsheetsTables = spreadsheets– Records = rows Records = rows – Fields = columnsFields = columns

Getting around in AccessGetting around in Access

http://home.comcast.net/~karlhorak/SQLexercises.mdbhttp://home.comcast.net/~karlhorak/SQLexercises.mdb

Getting Data OutGetting Data Out

QBE QBE – Drag-and-drop tables, fields, relationshipsDrag-and-drop tables, fields, relationships– Visual query builderVisual query builder

SQL SQL – Manually created and editedManually created and edited– Text-basedText-based

SPARQL SPARQL – RDF and XML-basedRDF and XML-based– Web 2.0 Web 2.0

SQLSQL

SELECT <fieldlist or expression>SELECT <fieldlist or expression>– From <table or query>From <table or query>– Where <condition>Where <condition>– Order by <field or expression>Order by <field or expression>

– Group by <field>Group by <field>– Having <condition>Having <condition>– ;;

QBEQBE

Exercises and Q&AExercises and Q&A

Download and open the EFAC Download and open the EFAC databasedatabase

Familiarize yourself with the Familiarize yourself with the structure and the datastructure and the data

Answer some questions by Answer some questions by building queriesbuilding queries

QueriesQueries

1.1. Display all data in the table. Display all data in the table. 2.2. Display just facility type and country for Display just facility type and country for

all items in the table. all items in the table. 3.3. Display the facility type, capacity, and Display the facility type, capacity, and

capacity units for just the facilities in capacity units for just the facilities in Brazil Brazil

4.4. Display facility type, country, and Display facility type, country, and capacity in kgU/year (hint: capacity is in capacity in kgU/year (hint: capacity is in metric tons, 1000 kg). Include a column metric tons, 1000 kg). Include a column that displays the units as "kgU/year". that displays the units as "kgU/year".