01 Intro
01 Intro
C. Faloutsos – A. Pavlo
Lecture#1: Introduction
CMU SCS
Today’s Agenda
• Course Overview & Logistics
• Introduction of Databases
Course Objective
• Students will learn the fundamentals of
database management systems.
– When to use them
– How to model data with them
– How to store and retrieve information
– How to search quickly for information
– System internals & key algorithms
Course Logistics
• Course Policies + Schedule:
– Refer to course web page.
• Academic Honesty:
– Refer to CMU policy page.
– If you’re not sure, ask the professors.
– Don’t be stupid.
Course Rubric
• Homework Assignments
• Midterm Exam
• Final Exam
Homework Assignments
• All assignments are due at the beginning of
the lecture (3:00pm), on the due date.
• All assignments are to be done individually.
• Late policy: Four “Slip” Days
• HW3 & HW7 require more programming
than the other assignments.
Exams
• Midterm: Wednesday October 19th
– In-class (this room)
– Materials up to October 12th & HW4 (inclusive)
• Final: TBA
– Comprehensive
Grading
• Assignments: 30%
– See course web page for HW weights.
• Midterm: 30%
• Final: 40%
• No extra credit is offered.
Special Accommodations
• Please contact the professors if you need
special accommodations for the homework
or exams before the due dates.
• Refer to CMU Accommodations Page
Office Hours
• Christos (GHC 8019)
– Tuesdays @ 2pm-3pm
• Andy (GHC 9019)
– Mondays @ 12pm-1pm
• Also available by appointment.
• See course website for TA hours.
Lecture Questions
• Ask questions during the lecture.
• If you are unsure about something, then
somebody else might have the same question.
• Don’t run up to talk to the professors
immediately after the lecture.
Course Topics
• Introduction to Databases
• Data Models
• Query Language (SQL)
• Database Design
• Query Optimization & Indexing
• Transaction Management
• Advanced Topics
Spring 2017
• 15-721 – Database Systems
– High-performance in-memory system internals
– Programming intensive
• 15-826 – Multimedia DBs & Data Mining
– Graph mining, time-series analysis, databases
for machine learning.
– Non-relational data
What is a Database?
Database Example
• Or why should you take this course?
• Let’s build a simple application…
Database Example
• Create a database to keep track of the music
that is available in our application.
Database Example
• Create a database to keep track of the music
that is available in our application.
Database
Database ≠ Management
System
DBMS
15-415/615
Types: Data Models
• Relational Traditional / NewSQL
• Key/Value
• Graph
NoSQL
• Document
• Column-family
• Array/Matrix
• Obsolete: Hierarchical, Network
Faloutsos/Pavlo CMU SCS 15-415/615 29
CMU SCS
CREATE ARTIST
CREATE TABLE
TABLE artist
artist (( CREATE ALBUM
CREATE TABLE
TABLE album
album (( TRACK
CREATE
CREATE TABLE
TABLE track
track ((
name
name VARCHAR(32)
VARCHAR(32) NOT
NOT NULL,
NULL, name
name VARCHAR(64)
VARCHAR(64) NOT
NOT NULL,
NULL, name
name VARCHAR(64)
VARCHAR(64) NOT
NOT NULL,
NULL,
genre name
genre VARCHAR(32),
VARCHAR(32), artist name
artist VARCHAR(32)
VARCHAR(32) NOT
NOT NULL
NULL name
album
album VARCHAR(64)
VARCHAR(64) NOT
NOT NULL
NULL
country
country CHAR(3),
CHAR(3), ↪REFERENCES
↪REFERENCES artist(name),
artist(name), ↪REFERENCES
↪REFERENCES artist(name),
artist(name),
PRIMARY
description
PRIMARY KEY
KEY (name)
(name) year
artist
year INT
INT CHECK(year
CHECK(year >> 0),
0),
album
tracknum
tracknum SMALLINT
SMALLINT
);
); country year
PRIMARY
PRIMARY KEY
KEY (name)
(name) number
↪CHECK(tracknum
↪CHECK(tracknum >> 0),
0),
);
); PRIMARY
PRIMARY KEY
KEY (name,
(name, tracknum)
tracknum)
);
);
Three-level Architecture
View Level View 1 … View n
What information is exposed to users,
what are they allowed to see…
Logical Level
What tables are there, what attributes do
Table
they have, what constraints should the
DBMS enforce…
Physical Level
How data is stored, where it is located,
how many bytes, what type of indexes… Storage
Course Topics
• Introduction to Databases
• Data Models
• Query Language (SQL)
• Database Design
• Query Optimization & Indexing
• Transaction Management
• Advanced Topics
Next Class
• Application Modeling
– Entities
– Relationships
– Attributes