itd 256 01

Upload: johnsimon

Post on 06-Jul-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/17/2019 ITD 256 01

    1/51

    ITD 256Database Concepts

    Lecture 01

  • 8/17/2019 ITD 256 01

    2/51

    Agenda

    • Introduction• Database Management

    • Syllabus

    Blackboard Use• MySQL Overview

    • List Problem

    • Class Exercise

    • What’s Next? 

    • Project Phase 1 Signup

    • Quiz

  • 8/17/2019 ITD 256 01

    3/51

    Agenda

    •   Introduction• Database Management

    • Syllabus

    Blackboard Use• MySQL Overview

    • List Problem

    • Class Exercise

    • What’s Next? 

    • Project Phase 1 Signup

    • Quiz

  • 8/17/2019 ITD 256 01

    4/51

    Introduction

    • Name / Nickname

    • Academic Plans / Major

    •Professional Goals / Career

    • Databases Experience

  • 8/17/2019 ITD 256 01

    5/51

    Introduction

    • Career Advice

     – Sooner than later

     –

    “Career” not a job  – Current & future high demand

     – Compensation

     – Job Security

  • 8/17/2019 ITD 256 01

    6/51

    Agenda

    • Introduction•  Database Management

    • Syllabus

    Blackboard Use• MySQL Overview

    • List Problem

    • Class Exercise

    • What’s Next? 

    • Project Phase 1 Signup

    • Quiz

  • 8/17/2019 ITD 256 01

    7/51

  • 8/17/2019 ITD 256 01

    8/51

  • 8/17/2019 ITD 256 01

    9/51

  • 8/17/2019 ITD 256 01

    10/51

  • 8/17/2019 ITD 256 01

    11/51

  • 8/17/2019 ITD 256 01

    12/51

  • 8/17/2019 ITD 256 01

    13/51

    Agenda

    • Introduction• Database Management

    •   Syllabus

    Blackboard Use• MySQL Overview

    • List Problem

    • Class Exercise

    • What’s Next? 

    • Project Phase 1 Signup

    • Quiz

  • 8/17/2019 ITD 256 01

    14/51

    Syllabus

    • Refer to the Syllabus Handout

  • 8/17/2019 ITD 256 01

    15/51

    Agenda

    • Introduction• Database Management

    • Syllabus

     Blackboard Use• MySQL Overview

    • List Problem

    • Class Exercise

    • What’s Next? 

    • Project Phase 1 Signup

    • Quiz

  • 8/17/2019 ITD 256 01

    16/51

    Blackboard

  • 8/17/2019 ITD 256 01

    17/51

    Agenda

    • Introduction• Database Management

    • Syllabus

    Blackboard Use•  MySQL Overview

    • List Problem

    • Class Exercise

    • What’s Next? 

    • Project Phase 1 Signup

    • Quiz

  • 8/17/2019 ITD 256 01

    18/51

    MySQL Overview

    • http://dev.mysql.com/downloads/

    • MySQL Installer

    MySQL Workbench

    • Installation instructions posted on BlackBoard

  • 8/17/2019 ITD 256 01

    19/51

    MySQL Overview

  • 8/17/2019 ITD 256 01

    20/51

    Agenda

    • Introduction• Database Management

    • Syllabus

    Blackboard Use• MySQL Overview

    •  List Problem

    • Class Exercise

    • What’s Next? 

    • Project Phase 1 Signup

    • Quiz

  • 8/17/2019 ITD 256 01

    21/51

    List Problem

    Data – Raw and unorganized facts

    • Information – Processed and organized facts

    •Database (non-technical term) – System to store data and provide information

    • Personal Databases – Keep track of information

     – Text/CSV files, Excel, MS Access• Enterprise Databases

     – Integral part of Information Systems

     – SQL Server, mySQL, Oracle, Teradata, DB2, etc.

  • 8/17/2019 ITD 256 01

    22/51

    List Problem

    • Student List in a Spreadsheet

     – Common operations?

  • 8/17/2019 ITD 256 01

    23/51

    List Problem

    • Add Advisor Data

     – Delete Data

     – Change Data

     – Insert Data

  • 8/17/2019 ITD 256 01

    24/51

    List Problem

    • Modification Problem

     – Cause of problem?

  • 8/17/2019 ITD 256 01

    25/51

    List Problem

    • Student with Residence List

     – Why no modification problem?

  • 8/17/2019 ITD 256 01

    26/51

    List Problem

    •List problems identified in the late 1960s – INSERT causes NULL values

     – DELETE removes too much information

     – UPDATE causes “Data Anomalies” when allredundant data changes are not made correctly

    • Relational Model

     – Single themed related tables

     – Databases provide data independence overfile processing models like excel, text, etc.

  • 8/17/2019 ITD 256 01

    27/51

    List Problem

     – So what is the solution?

  • 8/17/2019 ITD 256 01

    28/51

    List Problem

     – Identify the themes

     – Identify columns of each table

     – Identify rows data of each table

     –Identify Parent & Child tables

  • 8/17/2019 ITD 256 01

    29/51

    List Problem

     – Create & populate single themed tables

     – Identify unique identifiers in each table

  • 8/17/2019 ITD 256 01

    30/51

    List Problem

     – Which table gets the LINK and WHY?

    •  Place Parents nonrepeating link in Child table

    • Tables linked on AdviserLastName

  • 8/17/2019 ITD 256 01

    31/51

    List Problem

     – Is AdvisorLastName the best choice?

  • 8/17/2019 ITD 256 01

    32/51

    List Problem

    • Unique ID

     – Unique ID columns ensure unique identifying

    number

     – Unique ID columns added to link related tables

     – Linking column is always placed in child table

  • 8/17/2019 ITD 256 01

    33/51

    List Problem

    • Modification problem solved

     – No UPDATE issues

     – No INSERT issues

     – No DELETE issues

  • 8/17/2019 ITD 256 01

    34/51

    List Problem

    •Another example with 3 themes

  • 8/17/2019 ITD 256 01

    35/51

    List Problem

    •Which table(s) get the linking fields and why?

  • 8/17/2019 ITD 256 01

    36/51

    List Problem

    How many students are advised by Shawna’s Dept?

  • 8/17/2019 ITD 256 01

    37/51

    List Problem

    • Difficulties in processing tables

     – Managing tables

     – Jumping from table to table

    • Structured Query Language (SQL)

     – Developed in the 1980s

     – Universal Database sublanguage

     – Used for all Data Definitions & Manipulations

  • 8/17/2019 ITD 256 01

    38/51

    Agenda

    •Introduction

    • Database Management

    • Syllabus

    Blackboard Use• MySQL Overview

    • List Problem

    •  Class Exercise

    • What’s Next? 

    • Project Phase 1 Signup

    • Quiz

  • 8/17/2019 ITD 256 01

    39/51

    Exercise

    •  _________ is/are organized and processed facts.

    •  _________ is/are raw, unorganized, and unprocessed facts.

    • Databases provide _________ over file processing models.

    •  _________ modification problem removes too muchinformation.

    •  _________ occurs when all redundant data updates are notmade correctly

    •  _________ modification problem causes NULL values.

  • 8/17/2019 ITD 256 01

    40/51

    Agenda

    •Introduction

    • Database Management

    • Syllabus

    Blackboard Use• MySQL Overview

    • List Problem

    • Class Exercise

    • What’s Next? 

    • Project Phase 1 Signup

    • Quiz

  • 8/17/2019 ITD 256 01

    41/51

    What’s Next? 

    • Locate Labs at Annandale Campus

     – Open Labs in CT Building

     – ITD256 Lab in Class

    • Locate Labs in Loudoun Waddell Building

     – Open Lab in LW230

  • 8/17/2019 ITD 256 01

    42/51

    What’s Next? 

    • Purchase textbook

     – Optional but recommended

    • Download & Install MySQL

     – Installer

     – Workbench

  • 8/17/2019 ITD 256 01

    43/51

    HW 1

    1. Figure above shows a list that is used by a veterinary office. Give examples of three

    modification problems that are likely to occur when using this list. (3pts)

    2. Break the list in figure above into two tables, each with data for a single theme. Assume

    that owners have a unique OwnerEmail and pets have unique PetName column. Indicate the

    unique identifiers and linking column. (5pts)3. Describe how the tables you created in Q2 solves the problems you identified in Q1. (3pts)

    4. Why is it a bad idea to assume PetName as a unique identifier? (2pts)

    5. What is the difference between data and information? (2pts)

    6. How is relational model better than traditional file processing? (2pts)

    7. Describe in your own words how relationships between single themed tables arerepresented in a relational database. (2pts)

    8. Define the term database. (2pts)

    9. What is a DBMS? (2pts)

    10. Define the term “Data Anomaly” and give an example. (2pts) 

  • 8/17/2019 ITD 256 01

    44/51

    Agenda

    Introduction• Database Management

    • Syllabus

    Blackboard Use• MySQL Overview

    • List Problem

    • Class Exercise

    • What’s Next? 

    •   Project Phase 1 Signup

    • Quiz

  • 8/17/2019 ITD 256 01

    45/51

    Agenda

    Introduction• Database Management

    • Syllabus

    Blackboard Use• MySQL Overview

    • List Problem

    • Class Exercise

    • What’s Next? 

    • Project Phase 1 Signup

    •   Quiz

    Q i E i

  • 8/17/2019 ITD 256 01

    46/51

    Quiz Exercise

    • Identify the themes in list

    • Break the themes into respective tables

    • Determine unique identifiers in each table

    • Determine PARENT and CHILD tables

    • Place Parent's identifier as link in Child table

    • Draw & Populate the two tables showing all data

    EmpID 

    EmpFirst 

    EmpLast 

    MngrFirst 

    MngrLast 

    MngrID 

    22 

    Robert 

    Smith 

    James 

    Knight 

    11 

    Kevin 

    Brown 

    James 

    Knight 

    44 

    Alec 

    Stewart 

    Albert 

    Hudson 

    55 

    John 

    Charles 

    James 

    Knight 

    33 

    Rodney 

    Marsh 

    Albert 

    Hudson 

    Q i E i

  • 8/17/2019 ITD 256 01

    47/51

    Quiz Exercise

    • Identify the themes in list

    EMPLOYEEMANAGER

    • Break the themes into respective tables

    • Determine unique identifiers in each table

    • Determine PARENT and CHILD tables

    • Place Parent's identifier as link in Child table

    •Draw & Populate the two tables showing all data

    EmpID 

    EmpFirst 

    EmpLast 

    MngrFirst 

    MngrLast 

    MngrID 

    22 

    Robert 

    Smith 

    James 

    Knight 

    11 

    Kevin 

    Brown 

    James 

    Knight 

    44 

    Alec 

    Stewart 

    Albert 

    Hudson 

    55 

    John 

    Charles 

    James 

    Knight 

    33 

    Rodney 

    Marsh 

    Albert 

    Hudson 

    Q i E i

  • 8/17/2019 ITD 256 01

    48/51

    Quiz Exercise

    • Break the themes into respective tables

    EMPLOYEE (EmpID, EmpFirst, EmpLast)

    MANAGER (MngrFirst, MngrLast, MngrID)

    • Determine unique identifiers in each table

    • Determine PARENT and CHILD tables

    • Place Parent's identifier as link in Child table

    • Draw & Populate the two tables showing all data

    EmpID 

    EmpFirst 

    EmpLast 

    MngrFirst 

    MngrLast 

    MngrID 

    22 

    Robert 

    Smith 

    James 

    Knight 

    11 

    Kevin 

    Brown 

    James 

    Knight 

    44 

    Alec 

    Stewart 

    Albert 

    Hudson 

    55 

    John 

    Charles 

    James 

    Knight 

    33 

    Rodney 

    Marsh 

    Albert 

    Hudson 

    Quiz Exercise

  • 8/17/2019 ITD 256 01

    49/51

    Quiz Exercise

    • Determine unique identifiers in each table

    EMPLOYEE (EmpID, EmpFirst, EmpLast)

    MANAGER (MngrFirst, MngrLast, MngrID)

    • Determine PARENT and CHILD tables

    • Place Parent's identifier as link in Child table

    • Draw & Populate the two tables showing all data

    EmpID 

    EmpFirst 

    EmpLast 

    MngrFirst 

    MngrLast 

    MngrID 

    22 

    Robert 

    Smith 

    James 

    Knight 

    11 

    Kevin 

    Brown 

    James 

    Knight 

    44 

    Alec 

    Stewart 

    Albert 

    Hudson 

    55 

    John 

    Charles 

    James 

    Knight 

    33 

    Rodney 

    Marsh 

    Albert 

    Hudson 

    Quiz Exercise

  • 8/17/2019 ITD 256 01

    50/51

    Quiz Exercise

    • Place Parent's identifier as link in Child table

    EMPLOYEE (EmpID, EmpFirst, EmpLast, “ MngrID”) 

    MANAGER (MngrFirst, MngrLast, MngrID)

    • Draw & Populate the two tables showing all data

    EmpID 

    EmpFirst 

    EmpLast 

    MngrFirst 

    MngrLast 

    MngrID 

    22 

    Robert 

    Smith 

    James 

    Knight 

    11 

    Kevin 

    Brown 

    James 

    Knight 

    44 

    Alec 

    Stewart 

    Albert 

    Hudson 

    55 

    John 

    Charles 

    James 

    Knight 

    33 

    Rodney 

    Marsh 

    Albert 

    Hudson 

    Quiz Exercise

  • 8/17/2019 ITD 256 01

    51/51

    Quiz Exercise

    EMPLOYEE (EmpID, EmpFirst, EmpLast, “ MngrID”) 

    MANAGER (MngrFirst, MngrLast, MngrID)

    EmpID 

    EmpFirst 

    EmpLast 

    MngrFirst 

    MngrLast 

    MngrID 

    22 

    Robert 

    Smith 

    James 

    Knight 

    11 

    Kevin 

    Brown 

    James 

    Knight 

    44 

    Alec 

    Stewart 

    Albert 

    Hudson 

    55 

    John 

    Charles 

    James 

    Knight 

    33 

    Rodney 

    Marsh 

    Albert 

    Hudson 

    EmpID 

    EmpFirst 

    EmpLast 

    MngrID 

    22 

    Robert 

    Smith 

    11 

    Kevin 

    Brown 

    44 

    Alec 

    Stewart 

    55 

    John 

    Charles 

    33 

    Rodney 

    Marsh 

    MngrFirst 

    MngrLast 

    MngrID 

    James 

    Knight