cse4701introov - University of Connecticut

advertisement
CSE4701 Introduction to Databases
CSE
4701
Prof. Steven A. Demurjian
Computer Science & Engineering Department
The University of Connecticut
371 Fairfield Way, Box U-255
Storrs, CT 06269-3255
steve@engr.uconn.edu
http://www.engr.uconn.edu/~steve
(860) 486–4818 (Office)
(860) 486-3719 (CSE Office)
OV-1.1
Course Goals

CSE
4701 

Provide a Practical Introduction to Database Models,
Theory, and Systems
Focus on Both Theory and Practice
 Theory Demonstrates Strong Mathematical Basis
of Databases (Relational Model and Concurrency
Control)
 Practice Provides Experimental Framework for
Illustrating Theory (Actual Database Systems and
their Usage)
Exposure to Research Problems and Real-World
Experiences
OV-1.2
Course Philosophy

CSE
4701



Introduction to Fundamental Database Concepts
Promotion of Knowledge-Acquisition, Self-Learning,
and Independence
 Rapid Evolution of Computing
 Always Must Keep Skills Up-to-Date
 “Learn how to Learn”
Relevance of Database Concepts in Computing
 Software Engineering
 Object-Oriented Computing
 Operating Systems and Networks
 Almost Every Computer Science Area
Practical Exposure to SQL, JDBC, and DB Platform
(MySQL and Workbench)
OV-1.3
Textbooks and Class Materials

CSE
4701


UConn COOP has One Required Text …
 Fundamentals of Database Systems, Elmasri and
Navathe, Addison-Wesley 5th (2006), or 6th
(2009) editions
CSE4701 Web Site at …
 www.engr.uconn.edu/~steve/Cse4701/cse4701.ht
ml
 All Course Notes, Project Materials, Web Site
Links, Available On-Line
Other Class Materials
 Various other Web Sites
OV-1.4
Syllabus: Weekly Topic Coverage
CSE
4701
Weeks
Topic
Chapters

FOCUS ON CHAPTER TOPIC - NUMBERS FOR 6th/5th eds.

1
Introduction/Overview
Ch 1,2

1.5 Relational Model
Ch 3&6 6e, 7 5e

1
Basic & Advanced SQL
Ch 4&5 6e, 8 5e

1.5 Conceptual DB/ER Model
Ch 7&8 6e, 3&4 5e

1
ER-Relational Transl.
Ch 9 6e, 5 6e

1.5 DB Design, Normal Forms Ch 15&16 6e, 14 5e

1
XML & SQL Prog/PHP
Ch 12&13&14 6e

1
Design/Storage/Index Ch 17&18 6e, 13&14 5e

1
System Catalog/Query Op Ch 19 6e, 17&18 5e

1
Trans Proc/Conc. Cont. Ch 21&22 6e, 19&20 5e

1
Security & Recovery
Ch 22&23 6e, 21&22 5e

1
DBMS/Web/Mining Ch 26/28/29 6e, 24/26/27 5e

1
One Semester Exams + Final Exam
OV-1.5
Course Projects and Exams

CSE
4701





Projects: Individual &/or Team (30-50% of Grade)
 In Process of Being Defined
 We’ll Review …
Exams (40-50% of Grade)
 Likely Two Exams and Final
 Open Book and Open Notes
Home works (0-20%)
 Throughout the Semester - In Class also
 If no credit, Up to 2 Bonus Pts. Per Handed in
Assignment
Spring 2015– 40%P, 50%E, 10%H
Must Pass Both Projects And Exams to PASS!!!
Note: All Subject to Change – Use Breakdown that
Most Benefits Students
OV-1.6
Cheating/Collaboration


CSE
4701 





Not Tolerated in Any Form!!!
Severe Penalties are Likely!!!
See University of Connecticut Student Conduct Code
All Homeworks/Some Project Represent Individual
Effort!
Remaining Projects Represent Team Effort
Cooperative Problem Solving and Sharing Code is
NOT Permitted and Will Likely Lead to Fs!
Electronic Information is More Accessible!
Use Protection Capabilities on your Account to
Protect your Files!
OV-1.7
Lateness Policies/Exams

CSE
4701 





Late Assignments (Projects) will Not be Accepted
Except with Prior Permission or Emergencies
Prior Permission: Contact the Instructor Three Days
Before the Due Date
Emergencies: Illness, Death in the Family, etc.
Contact
 S. Demurjian at ITE265, x6-4818, by
steve@engr.uconn.edu, or via the CSE Office,
ITE250, x6-3719
A Late Assignment is Recorded as a Zero Grade
Assignment Due Date Means Start of Class!!!
Makeup on Absent Exam at Instructor’s Discretion
OV-1.8
Class Attendance and Computing

CSE
4701

Attendance in Class is …
 Responsibility of each Student
 May Result in Missing Hint/Clarification/Error on
Class Project
 Change in Due Date or Exam Date
 I Won’t Guarantee that All Information Makes it
to Web!
Computing for Class is …
 Predominately PCs - ITE Concourse Level or
Engineering Learning Center (ITE 1st floor)
 Take Files with You!
 Your Responsibility to Protect Your Files
OV-1.9
Remainder of Today’s Material

CSE
4701 




What is a Database?
 Motivation, Defining, Tables, Querying
Main Software for the Course
 MySQL and MySQL Workbench
Other Technologies
 XAMPP and MyphpAdmin
A Useful Windows Utility
Homework 0
Introducing the Semester Project
OV-1.10
What is a Database?

CSE
4701


Database (DB) is a Structured Collection of Data
about the Entities that Exist in an Enterprise and that
are Used (Shared) by Applications of an Enterprise
The Structure of the Database is Dependent Upon the
Data Model that is Used - Understanding the Terms:
 Database (DB)
 Database System (DBS)
 Database Management Systems (DBMS)
What can be a Database?
 Address Book, Contact List, Calendar,
Bookmarks, Flat File Against Which a Program is
Executed, Real-Time Data Sensor Feed into
Embedded Program, Set of Word or Excel
Documents, Fitness Data from App or Device,
Recipes, etc.
OV-1.11
What Does a Database Contain?

CSE
4701
Conceptually – One View
 Consider Excel Spreadsheet with Multiple Tabs
 Tabs: Employee, Department, Projects,
 Each Tab has Columns that Each have Own Types
 Each Tab has Data for All Columns/Multiple Rows
 Data is Static, Human Readable/Updateable
OV-1.12
Excel Spreadsheet Example
CSE
4701
OV-1.13
What Does a Database Contain?

CSE
4701
Conceptually – Another View
 Consider a set of Java Classes
 Employee, Manager ISA Employee, Department,
Projects, etc.
 Each Class has Single Instance
 Need to Use Collection in Java for Set of
Instances
class Employee {
private
String
private
Date
private
double
private
integer
public
Name, SSN, Address;
BirthDate;
Salary;
DeptNum;
Empolyee() { ... };
};
OV-1.14
What are Problems with each?

CSE
4701
Both Cases:
 Data is Not Stored in a Permanent Repository
 Data Not easily Sharable/Modified by Multiple
Users Simultaneously
 Data Consistency Constraints Not Enforceable
 DeptNum in Employee/Project vs. Number in
Department
 Same Issue across Classes

Need
 Way to Persistently store Data
 Accessible by Multiple Users
OV-1.15
Defining a Database Table
CREATE TABLE EMPLOYEE
( FNAME
VARCHAR(15)
NOT NULL ,
CSE
MINIT
CHAR ,
4701
LNAME
VARCHAR(15)
NOT NULL ,
SSN
CHAR(9)
NOT NULL ,
BDATE
DATE
ADDRESS VARCHAR(30) ,
SEX
CHAR ,
SALARY
DECIMAL(10,2) ,
SUPERSSN CHAR(9) ,
DNO INT NOT NULL ,
PRIMARY KEY (SSN) ,
FOREIGN KEY (SUPERSSN)
REFERENCES EMPLOYEE(SSN) ,
FOREIGN KEY (DNO)
REFERENCES DEPARTMENT(DNUMBER) ) ;
OV-1.16
A Schema Contains Multiple Tables
CSE
4701
OV-1.17
…filled with Rows of Tuples/Instances
Which Represent Tuples/Instances of Each Relation
CSE
4701
A
S
C
null
W
B
null
null
1
4
5
5
OV-1.18
…filled with Rows of Tuples/Instances
CSE
4701
OV-1.19
SQL Searches the Tables

CSE
4701
Retrieve the Birthdate and Address of the Employee
whose Name is 'John B. Smith'.
SELECT BDATE, ADDRESS
FROM EMPLOYEE
WHERE FNAME='John' AND MINIT='B’
AND LNAME='Smith’

Which Row(s) are Selected?
B
S
C
null
W
B
null
null
OV-1.20
Main Software for Class
CSE
4701

MySQL and MySQL Workbench
OV-1.21
Loading a Database Schema
CSE
4701
Select File, Open SQL Script, and browse to the
directory to select demo-1.11.0.sql and from the
window below, select, the Open option
OV-1.22
Loading a Database Schema
CSE
4701
OV-1.23
The Database Tables
CSE
4701
OV-1.24
To Load a Database – back to this Tab
Click on Localhost
CSE
4701

MySQL and MySQL Workbench
OV-1.25
Result is Following Screen
Select Run SQL Script choose demo-1.11.0.sql
CSE
4701
Note: Lots of Data,
Takes five or more
Minutes
OV-1.26
Screen that Appears while Loading .sql
CSE
4701
OV-1.27
Resulting Screen to Query Database
CSE
4701
OV-1.28
Querying the Database
SELECT * FROM OpenMRS.Person;
CSE
4701
OV-1.29
Result of Query
CSE
4701
OV-1.30
Query Results Window
CSE
4701
OV-1.31
Export to csv
CSE
4701
OV-1.32
Extended Entity Relation Diagram
CSE
4701
OV-1.33
Other Technologies - XAMPP

CSE
4701


XAMPP includes: Apache, PHP, MySQL, and other
goodies. No need to download and install them
separately, XAMPP does it all.
Download:
https://www.apachefriends.org/download.html
FAQs (Includes instructions on how to install it and
set it up):
 Windows FAQs:
https://www.apachefriends.org/faq_windows.html
 OSX FAQs:
https://www.apachefriends.org/faq_osx.html
 Linux FAQs:
https://www.apachefriends.org/faq_linux.html
OV-1.34
The XAMPP Control Panel
CSE
4701
OV-1.35
Other Use Technologies -phpMyAdmin
CSE
4701
OV-1.36
CSE
4701
OV-1.37
CSE
4701
OV-1.38
CSE
4701
OV-1.39
CSE
4701
OV-1.40
CSE
4701
OV-1.41
CSE
4701
OV-1.42
CSE
4701
OV-1.43
CSE
4701
OV-1.44
CSE
4701
OV-1.45
Another Useful Capability


CSE
4701 

Suppose Install MySQL + Workbench
Then Install XAMPP Which Also Installs MySQL
May End up with Multiple Instances of MySQL
On Windows/Control Panel/Admin Tools/Services
OV-1.46
On Windows/Control Panel/Admin Tools/Services
CSE
4701
Stop
Start
Pause
Service
OV-1.47
Homework 0

CSE
4701
Install MySQL


Homework 0



http://www.engr.uconn.edu/~steve/Cse4701/MySQLinstal
l.docx
http://www.engr.uconn.edu/~steve/Cse4701/cse4701hw0I
nstructions.docx
Install and Play with Chinook and Northwind DBs
Also Explore XAMPP and MyphpAdmin
OV-1.48
Chinook Loaded with Query on Employee
Arrow shows save to a csv file
CSE
4701
OV-1.49
Query Results in Excel
CSE
4701
OV-1.50
Project Requirements

CSE
4701



Team Project - Discussion Between Teams Allowed
if you are Helping with DB Configuration,
Programming Question, etc., NOT Joint
Design/Development!
Will either Be Teams of 3 or 4 - TBD
Implementation Languages/Platform
 MySQL Workbench, php, html/css
 Eclipse PHP or Aptana Studio 3
Should Work on Chrome and Explorer
OV-1.51
Project Focus

CSE
4701
Design, Extend, Develop, and Test a UI/ Information
System for for Customers and Employees of Either:
 Chinook Database Sample: Digital media store,
tables for artists, albums, media tracks, etc.
 https://chinookdatabase.codeplex.com/

NorthwindExtended Database Sample – Database
of Employees, Customers, Suppliers, etc.
 https://code.google.com/p/northwindextended/
OV-1.52
Chinook
CSE
4701
OV-1.53
Northwind
CSE
4701
OV-1.54
Clients and Software Architecture
CSE
4701
Web Client
REST
API
php
Connect and
Interact with
MySQL
MySQL
Web Client
Back half is the implementation of
Front half contains
API (Java calls) that the classes that contains code to open
the database connection, perform a
hide DB interactions
query, collect results, etc.
from Client
OV-1.55
Download