1 welcome to the world of databases! database technology: crucial to the operation and management of...

12
1 Welcome to the World of Databases! Database technology: crucial to the operation and management of modern organisations Major transformation in computing skills Significant time commitment Exciting journey ahead

Upload: juliana-thompson

Post on 19-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Welcome to the World of Databases! Database technology: crucial to the operation and management of modern organisations Major transformation in computing

1

Welcome to the World of Databases!

Database technology: crucial to the operation and management of modern organisations

Major transformation in computing skills Significant time commitment Exciting journey ahead

Page 2: 1 Welcome to the World of Databases! Database technology: crucial to the operation and management of modern organisations Major transformation in computing

2

Subject Goals

First course in database management Practical

Query formulation for application developmentData modeling and normalisationBackground about database administration

No theoretical proofs or axioms

Page 3: 1 Welcome to the World of Databases! Database technology: crucial to the operation and management of modern organisations Major transformation in computing

3

University Database

University Database

Registration

GradeRecording

FacultyAssignment

CourseScheduling

Entities: students, faculty, courses, offerings, enrollmentsRelationships: faculty teach offerings, students enroll in offerings, offerings made of courses, ...

Page 4: 1 Welcome to the World of Databases! Database technology: crucial to the operation and management of modern organisations Major transformation in computing

4

Water Utility Database

Page 5: 1 Welcome to the World of Databases! Database technology: crucial to the operation and management of modern organisations Major transformation in computing

5

DBMS Marketplace Enterprise DBMS

Oracle: dominates in Unix; strong in NT SQL Server: strong in NT Informix: significant Unix market share DB2: strong in mainframe environment

Desktop DBMS Access: dominates FoxPro, Paradox, Approach, FileMaker Pro

Open-source DBMS MySQL PostgreSQL

Page 6: 1 Welcome to the World of Databases! Database technology: crucial to the operation and management of modern organisations Major transformation in computing

6

Tables Relational database is a collection of

tables Heading: table name and column names Body: rows, occurrences of data

StdSSN StdLastName StdMajor StdClass StdGPA 123-45-6789 WELLS IS FR 3.00 124-56-7890 NORBERT FIN JR 2.70 234-56-7890 KENDALL ACCT JR 3.50

Student

Page 7: 1 Welcome to the World of Databases! Database technology: crucial to the operation and management of modern organisations Major transformation in computing

7

Entity Integrity: primary keys

Each table has column(s) with unique values

… the primary key

No two rows with the same primary key valueNo null values in a primary key

Page 8: 1 Welcome to the World of Databases! Database technology: crucial to the operation and management of modern organisations Major transformation in computing

8

The “Faculty” Table

FacSSN FacFirstName FacLastName FacRank FacSalary FacSupervisor 098-76-5432 LEONARD VINCE ASST $35,000 654-32-1098 543-21-0987 VICTORIA EMMANUEL PROF $120,000 654-32-1098 LEONARD FIBON ASSC $70,000 543-21-0987 765-43-2109 NICKI MACON PROF $65,000 876-54-3210 CRISTOPHER COLAN ASST $40,000 654-32-1098 987-65-4321 JULIA MILLS ASSC $75,000 765-43-2109

Page 9: 1 Welcome to the World of Databases! Database technology: crucial to the operation and management of modern organisations Major transformation in computing

9

What is SQL?

Structured Query Language Language for database definition,

manipulation, and control International standard Standalone and embedded usage “Intergalactic database-speak”

Page 10: 1 Welcome to the World of Databases! Database technology: crucial to the operation and management of modern organisations Major transformation in computing

10

First “SELECT” Examples

See slide 8 for the “faculty” table …

Example 1 SELECT * FROM Faculty;

… will list everything in the “Faculty” table.

Example 2 SELECT FacFirstName, FacLastName, FacSalary FROM Faculty;

… will just list those three columns.

Page 11: 1 Welcome to the World of Databases! Database technology: crucial to the operation and management of modern organisations Major transformation in computing

11

First SELECT ExamplesExample 3

SELECT FacFirstName, FacLastName, FacSalary FROM Faculty WHERE FacSalary > 65000;

… will just list those with a salary greater than $65000.

Page 12: 1 Welcome to the World of Databases! Database technology: crucial to the operation and management of modern organisations Major transformation in computing

12

Other Single Table Examples

Example 4 SELECT FacFirstName, FacLastName, FacSalary FROM Faculty WHERE FacSalary > 65000 AND FacRank = 'PROF‘;

Example 5: Testing for null values SELECT OfferNo, CourseNo FROM Offering WHERE FacSSN IS NULL;

… NULL is not the same thing as zero!