CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: [email protected]...

26
CMPT 258 Database Systems Instructor: Tina Tian

Transcript of CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: [email protected]...

Page 1: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

CMPT 258 Database SystemsInstructor: Tina Tian

Page 2: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

General Information

•Email: [email protected]•Office: RLC 203A•Office Hour: Wednesday 1:30 - 4:30 PM

or by appointment•Website: home.manhattan.edu/~tina.tian

Page 3: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

About the Course

•Mon, Thur 3:00 - 4:15 PM•Textbook:

▫Database Management Systems, 3rd Edition by Raghu Ramakrishnan and Johannes Gehrke

Page 4: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

Grading

•1st Midterm Exam (in class, 5th week)15%

•2nd Midterm Exam (in class, 10th week) 15%

•Final Exam 30%

•Homework 40%

Page 5: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

About the Homework

•Only hard copy is accepted. (Complicated ER diagrams can be drawn by hand)

•Make a cover page (name, homework number)

•Due in a week after being announced•Late work will not be accepted

Page 6: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

Homework Policy

•You may discuss the homework/projects with other students.

•However, you must acknowledge the people you worked with.

•And you must independently write up your own solutions.

•Any written sources used (apart from the text) must also be acknowledged.

Page 7: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

Advises

•Take notes •Start the homework and programming

assignments early

Page 8: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

What will be covered

•This course introduces the fundamental concepts of database management▫Introduction to database management

(Chap 1)▫The entity relationship data model and

conceptual schema design (Chap 2)

Page 9: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.
Page 10: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

What will be covered

•The relational data model and relational database design (Chap 3)

•Relational algebra (Chap 4)•SQL queries (Chap 5)

Page 11: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.
Page 12: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

12

Page 13: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

(sid) sname rating age (sid) bid day

22 dustin 7 45.0 22 101 10/ 10/ 96

22 dustin 7 45.0 58 103 11/ 12/ 96

31 lubber 8 55.5 22 101 10/ 10/ 96

31 lubber 8 55.5 58 103 11/ 12/ 96

58 rusty 10 35.0 22 101 10/ 10/ 96

58 rusty 10 35.0 58 103 11/ 12/ 96

Page 14: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

Q6: Find sid’s of sailors who’ve reserved a red boat but not a green boat:

SELECT S.sidFROM Sailors S, Boats B, Reserves RWHERE S.sid=R.sid AND R.bid=B.bid AND B.color=‘red’ AND S.sid NOT IN (SELECT S2.sid FROM Sailors S2, Boats B2, Reserves R2 WHERE S2.sid=R2.sid AND R2.bid=B2.bid AND B2.color=‘green’)

Page 15: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

What will be covered

•Application development (Chap 6 & Chap 7 & supporting material)▫JDBC (Java)▫Web (PHP)

Page 16: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

What will be covered•Database privileges

A database is accessible to many users, and not every user should be allowed to do everything.

▫The owner of the restaurant should be able to view and/or change any data.

▫The restaurant accountant should be able to see, but not change, salary information.

Page 17: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

What will be covered• Transactions (Chap 16)

▫Now consider the following scenario: Two customers, Bob and Mary, arrive at about the same time and each go to a different register. Bob orders a Garden Salad. Bob’s register runs Query 11.1, which indicates that there are enough ingredients to make his order. While Bob decides if he wants to order a drink, Mary also orders a Garden Salad. Mary’s register runs Query 11.1, which again indicates that there are enough ingredients to make her order. Mary immediately pays for her order, and her register executes Update 11.2.

Page 18: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

Example•We always want to make sure that we

have all of the ingredients for every item before we submit a customer’s order.

18

Page 19: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

What will be covered

•Schema refinement and normal forms (Chap 19)▫Redundancy causes several problems

associated with relational schemas.▫Functional dependencies, can be used to

identify schemas with such problems and to suggest refinements.

Page 20: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

What will be covered

•NoSQL

Page 21: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

Software

•MySQL ▫MySQL is the most widely used open-

source relational database management system.

▫free and open source

Page 22: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

Download MySQL

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

Page 23: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.
Page 24: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.
Page 25: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.
Page 26: CMPT 258 Database Systems Instructor: Tina Tian. General Information Email: tina.tian@manhattan.edu Office: RLC 203A Office Hour: Wednesday 1:30 - 4:30.

Readings

•Chapter 1•Download and install MySQL