Class 5 LBSC 690 Information Technology

Slides:



Advertisements
Similar presentations
Programming Paradigms and languages
Advertisements

Programming Class 9 LBSC 690 Information Technology.
Programming Week 5 LBSC 690 Information Technology.
Databases Week 7 LBSC 690 Information Technology.
Week 6 LBSC 690 Information Technology
Databases Week 6 LBSC 690 Information Technology.
Spreadsheets and Databases Class 8 LBSC 690 Information Technology.
Microsoft ® Office Word 2007 Training Mail Merge II: Use the Ribbon and perform a complex mail merge [Your company name] presents:
Microsoft Access Ervin Ha.
Microsoft Access Database software. What is a database? … a database is an organized collection of data. A collection of data of similar information compiled.
Microsoft Access Intro Class 1 Database Concepts.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 1. Chapter 2: Relational Databases and Multi-Table Queries Exploring Microsoft Office.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
XP New Perspectives on Microsoft Office Access 2003 Tutorial 12 1 Microsoft Office Access 2003 Tutorial 12 – Managing and Securing a Database.
Microsoft Access 2003 Define some key Access terminology: Field – A single characteristic or attribute of a person, place, object, event, or idea. Record.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
Management Information Systems MS Access MS Access is an application software that facilitates us to create Database Management Systems (DBMS)
Databases Week 5 LBSC 690 Information Technology.
Chapter 17 Creating a Database.
MS Access 2007 Management Information Systems 1. Overview 2  What is MS Access?  Access Terminology  Access Window  Database Window  Create New Database.
Relational Databases Week 11 LBSC 671 Creating Information Infrastructures.
ITGS Databases.
1 CSE 2337 Introduction to Data Management Access Book – Ch 1.
Database Management Systems (DBMS)
Lesson 13 Databases Unit 2—Using the Computer. Computer Concepts BASICS - 22 Objectives Define the purpose and function of database software. Identify.
CPSC 203 Introduction to Computers T97 By Jie (Jeff) Gao.
Programming Session 6 LBSC 690 Information Technology.
Course Contents Overview: Database basics Lesson 1: Benefits of using a database Lesson 2: Table that data Lesson 3: Analyzing, viewing, and reporting.
Office 2003 Introductory Concepts and Techniques M i c r o s o f t Access Project 1 Creating and Using a Database.
The purpose of a CPU is to process data Custom written software is created for a user to meet exact purpose Off the shelf software is developed by a software.
N5 Databases Notes Information Systems Design & Development: Structures and links.
Introduction to Computers
Databases: What they are and how they work
New Perspectives on Microsoft Access 2016
Development Environment
Prepared By: Bobby Wan Microsoft Access Prepared By: Bobby Wan
Microsoft Office Access 2010 Lab 3
IST 220 – Intro to Databases
Databases Chapter 9 Asfia Rahman.
GO! with Microsoft Office 2016
Chapter 6 - Database Implementation and Use
Exploring Microsoft Office Access 2007
Practical Office 2007 Chapter 10
Introduction to Computing
Introduction To Repetition The for loop
Information Systems Today: Managing in the Digital World
and Defining Table Relationships
BASIC INFORMATION ABOUT DATABASE MANAGEMENT SOFTWARE
GO! with Microsoft Access 2016
Modern Systems Analysis and Design Third Edition
Databases.
Exploring Microsoft Office Access 2007
Teaching slides Chapter 9.
What is a Database and Why Use One?
Introduction to Computers
Designing and Debugging Batch and Interactive COBOL Programs
More about Databases.
Microsoft Office Access 2003
Programming We have seen various examples of programming languages
Computer Science Projects Database Theory / Prototypes
Week 5 LBSC 690 Information Technology
Spreadsheets, Modelling & Databases
Exploring Microsoft Office Access 2010
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Week 6 LBSC 690 Information Technology
Executive Admin Assistant
Executive Admin Assistant
Presentation transcript:

Class 5 LBSC 690 Information Technology Databases Class 5 LBSC 690 Information Technology

Agenda Questions Databases Programming Concepts Relational database design Implementation using Microsoft Access Programming Concepts The mythical person-month Object oriented programming

Relational Databases Tables represent relations Name, project Name, email address, phone number Relations can be “joined” (**most important**) Name, project, email address, phone number Relations can be “projected” Name, email address Relations can be “restricted” Name = “Doug Oard”

Why use Join? Forces consistency Limits the chance of error Doug Oard, project 18, oard@glue, 57590 Doug Oard, project 22, oard@wam, 57590 Limits the chance of error Doug Oard, project 19, oard@glue, 57490 Avoids lots of duplicated entry and updates Can save a lot of storage space compared to a flat file

Problems with Joins Data modeling for joins is complex Taught in LBSC 670 Joins are expensive to compute Both in time and storage space But it is joins that make databases “relational” Projection and restriction also used in flat files

Key Fields Primary Key uniquely identifies line to join May group several fields to get a unique key Social security number First and last name “Foreign” key must appear in the other table But it need not be unique there Join makes a new table Line specified by foreign key is tacked on

Example of a Join on “Team” Name Team Team Project Name Team Project Chris A A Database Chris A Database Chris A B Web Chris A Database Camile A C Web Camile A Database Eileen B Eileen B Web Natalie C Natalie C Web David B David B Web Tonya C Tonya C Web Skip C Skip C Web

Keep Just Two Fields Name Team Team Project Name Project Chris A A Database Chris Database Chris A B Web Chris Database Camile A C Web Camile Database Eileen B Eileen Web Natalie C Natalie Web David B David Web Tonya C Tonya Web Skip C Skip Web

Restrict to Web Pages Name Team Team Project Name Project Chris A A Database Eileen Web Chris A B Web Natalie Web Camile A C Web David Web Eileen B Tonya Web Natalie C Skip Web David B Tonya C Michelle Skip C

How to Split Tables The idea is to remove redundancy For simple problems (like the homework) Start with “binary relationships” Pairs of fields that are related Group together wherever possible Add keys where necessary For more complicated problems Entity relationship modeling (LBSC 670)

FlightFinder Exercise Design a database to match passengers with available flights on corporate jets Companies phone in available seats They want to know about interested passengers Passengers call up looking for flights They want to know about available flights These things happen in no particular order

Exercise Goals Identify the tables you will need Design the queries First decide what data you will save What questions will be asked? Then decide how to group it into tables Start with binary relations if that helps Design the queries Using join, project and restrict Add primary and foreign keys where needed

Exercise Logistics Work in groups of 3 or 4 Brainstorm data requirements for 5 minutes Do customers care about the price? Do companies care what passengers weigh? Develop tables and queries for 15 minutes Don’t get hung up on one thing too long Compare you answers with another group Should take about 5 minutes

One Possible Answer Surely you didn’t expect this in the notes :) Tables: Flight: Flight Number, Origin, Destination, Departure Time, Arrival Time, Available Seats, Company Name, Price Passenger: Passenger Number, Name, Address, Phone Number Company: Company Name, Company Address, Company Phone Booking: Flight Number, Passenger Number Queries: Passenger calls: Join: Flight, Company Project: Departure Time, Company Phone Restrict: Origin, Destination, Available Seats>0 Company calls: Join: Flight, Passenger, Booking Project: Flight Number, Name, Phone Number Restrict: Company Name

Microsoft Access Start Access Name your database planes.mdb in M:\ Icon in the Microsoft Office folder Name your database planes.mdb in M:\ Click “Table” and then “New” Select “New Table” Table wizards can be helpful (query wizards are not) Enter the fields

Entering Fields Field Names must be unique in a table Select field type from a menu Use date/time for times Use text for phone numbers Use right mouse button for primary key Save the table when you’re done That’s when you get to name it Exit, then reselect to enter the data

Building Queries Copy N:\share\class\flight.* to M:\ Select “Queries” then “New” Skip the query wizard Choose two tables Flight and Company Pick each field you need using the menus Unclick the X to “unproject” Enter a criteria to “restrict” Save, exit, and reselect to run the query

Fun Facts about Queries Joins are automatic if field names are same Otherwise, drag a line between the fields Sort order is easy to specify Use the menu Queries form the basis for reports Reports give good control over layout Use the report wizard - the formats are complex

Other Things to Know “Referential integrity” assures joins will work Need to specify this when defining tables Forms manage input better than raw tables Invalid data can be identified when input Graphics can be incorporated

Key Ideas Databases are a good choice when you have Lots of data A problem that contains inherent relationships Design before you implement This is just another type of programming The mythical person-month applies! Join is the most important concept Project and restrict just remove undesired stuff

Database Projects Design for large amounts of data Must use multiple tables Need a plan for long-term maintenance How will data be removed? Attention to the user interface Forms and reports Web interfaces are hard Enough content to verify proper operation

Software Software models aspects of reality Examples Input and output represent the state of the world Software describes how the two are related Examples Ballistic computations Homework 6 Alta Vista Microsoft Word

Programming Languages Used to specify every detail of the model Special purpose Able to specify an entire class of models Spreadsheets (Excell, Quatro Pro, ...) Databases (Access, Paradox, ...) General purpose Able to specify any possible model Pascal, C, Java, ...

The Mythical Person-Month If it would take one person three months, why does it take four people SIX months? Four causes It wouldn’t have taken 3 months anyhow! Partitioning strategy Training time Communications effort

How long will it take? Rules of thumb 1/3 specification 1/6 coding 1/2 test planning, testing, and fixing! Add time for coding to learn as you go, but don’t take time away from the other parts! Reread the section on “gutless estimating” if you are tempted

Training Time Simple Example Full time person = 2,000 hours/year Part time person = 288 hours per year No training -> 7 part time people With training -> 10 part time people Learning the specification takes lots of time Learning organizational “rules” takes longer

Communications Sort of like continuous training Who needs to know what I just learned? Can be minimized by good partitioning Limit the number of interfaces Can be facilitated by computers Asynchronous communication techniques Email, BBS, voice mail

History of Programming Machine code Zeroes and Ones Assembly language “Assembler” changes names to machine code High-level languages “Compiler” translates math to machine code Independent of machine “architecture” FORTRAN, COBOL

History of Programming Structured Programming Group instructions into meaningful abstractions C, Pascal Object oriented programming Group “data” and “methods” into “objects” C++, Java

Object Models Represent facts about the world as “data” Combine data into “data structures” Data structures model things Represent actions using “operations” Combine operations into “methods” Methods model what can be done to things “Classes” are data structures with methods Classes model aspects of reality

A Simple Example Data: Height, Weight, Shoe size Data structure: All three together Operations: Multiply, Divide Method: Shoe size=4*Weight/Height Class: Method & data structure

Instances Classes actually model kinds of things “person” in the example is a class Objects are instances of a class Object representing me is an instance of person Object Oriented Programming Define classes (data structures and methods) Create objects Perform some methods

Data Types int float char boolean Like integers, but there is a biggest and smallest float Like real numbers, but there are a finite number char Any character in any language (UNICODE) boolean True or false

Data Structures Arrays Structures Lists of some type of data Every element must be the same type Each is assigned a number (0, 1, 2, ...) An array of type “char” is called a “string” Structures Groups of (possibly) different data types Each must be given a name by the programmer

Operations Same idea as methods - int produces int But applied to data types rather than structures - int produces int int + int produces int int * float produces float int < int produces boolean char == char produces boolean

Making Methods Actions can be operations or methods Three ways to combine actions Sequential (...; ...) Conditional (if...then...else) Loop (do...while, for ...) Every possible model can be built this way!

Java Objects Represent things in the real world Those things may be fairly abstract, though Encapsulate data and methods Data are the facts you seek to model Methods represent actions Classes are types of objects When instantiated, you get an individual object

Java Data Types boolean int float char True or false Like integers, but there is a biggest and smallest float Like real numbers, but there are a finite number char Any character in any language (UNICODE)

Java Data Structures Array String A list of things Every element must be the same type Each is assigned a number (0, 1, 2, ...) String An array of characters Methods are provided for printing, etc.

Java Operations Things you can do to data Examples: int < int produces boolean char == char produces boolean int + int produces int int * float produces float - int produces int

Java Statements Assignment Call to a method numberOfBirds = numberOfHawks + numberOfOrioles; Call to a method airForceOne = new Airplane(“747”); Altitude = aifForceOne.readAltitude(); Return a valule from a method return numberOfBirds;

Combining Statements Three ways to combine statements Sequential (...; ...) Separate each with a semicolon (statement1; statement2) Group using braces ({statement1;statement2}) Conditional (if ... then ... else or try ... catch ...) Loop (do ... while, for ...) Every possible model can be built with these 3!