Lecture 01
Lecture 01
Introduction
• Final:
– 8:30-10:20 a.m. Monday, Jun. 5, 2006
– In this room
Goals of the Course
• Using database systems
HW2:
problem sets, no programming
theory, optimizations, query execution,
transactions
Project: 30%
• Choose from a list of mini-research
topics, or come up with your own
• Open ended
• Write short research paper (2-3 pages)
• Conference-style presentation
Project: 30%
• Goals: apply database principles to a new problem
– Understand and model the problem
– Research and understand related work (1-2 papers)
– Propose some new approach (creativity will be evaluated)
– Implement some part
• Entities:
Actors (800k), Movies (400k), Directors, …
• Relationships:
who played where, who directed what, …
Want to store and process locally; what functions do we need ?
Functionality
1. Create/store large datasets
2. Search/query/update
3. Change the structure
4. Concurrent access to many user
5. Recover from crashes
6. Security (not here, but in other apps)
Possible Organizations
• Files
• Spreadsheets
• DBMS
1. Create/store Large Datasets
• Files Yes, but…
• DBMS Yes
2. Search/Query/Update
• Simple query:
– In what year was ‘Rain man’ produced ?
• Multi-table query:
– Find all movies by ‘Coppola’
• Complex query:
– For each actor, count her/his movies
• Updating
– Insert a new movie; add an actor to a movie; etc
2. Search/Query/Update
• Files Simple queries
• DBMS All
Updates: generally OK
3. Change the Structure
Add Address to each Actor
Very hard
• Files
• Spreadsheets Yes
• DBMS Yes
4. Concurrent Access
Multiple users access/update the data concurrently
connection
(ODBC, JDBC)
Database server
(someone else’s
Data files C program) Applications
DBMS = Collection of Tables
Directors: Movie_Directors:
id fName lName id mid
15901 Francis Ford Coppola 15901 130128
... ...
Movies:
mid Title Year
130128 The Godfather 1972
...
SELECT
SELECT title
title
FROM
FROM Movies,
Movies, Directors,
Directors, Movie_Directors
Movie_Directors
WHERE
WHERE Directors.lname
Directors.lname== ‘Coppola’
‘Coppola’ and
and
Movies.mid
Movies.mid == Movie_Directors.mid
Movie_Directors.mid and
and
Movie_Directors.id
Movie_Directors.id ==Directors.id
Directors.id
• What
Wehappens behind
will study SQL the scenedetails
in gory ? in this course
ALTER
ALTERTABLE
TABLE Actor
Actor
ADD
ADD address
address CHAR(50)
CHAR(50)
DEFAULT
DEFAULT ‘unknown’
‘unknown’