CS145 Introduction to Databases

NVIDIA Auditorium on TTh 3:00-4:20pm

Chat with us on the course Piazza site if you have any questions!

Description
This course covers database design and the use of databases in applications, with a short introduction to the internals of relational database engines. It includes extensive coverage of the relational model, relational algebra, and SQL. The course also features database design and relational design principles based on dependencies and normal forms. Many additional key database topics from the design and application-building perspective are also covered, including indexes, views, transactions, and integrity constraints. Systems such as MapReduce framework and key-value stores will also be covered. There will be a programming project, which explores database design and management in web applications by utilizing appropriate features of SQL.
Class Logistics

We're excited to once again utilize Jupyter notebooks to allow for more interactivity in the class. Installation instructions are available here. Python is used in the in-class activities, homework and projects.

Lecture Plan

The reading material listed below is optional, but it refers to Database Systems: The Complete Book by Garcia-Molina, Ullman, and Widom. The lecture plan below may change.


# Date Topic Lecture Materials Extra Reading Material Assignments
Introduction and Querying
1 9/26 Course Logistics and Database History Lecture 1 (pdf)

Activities:
Activity 1-1
Activity 1-2
Activity db
Jupyter Install Instructions
2 9/28 SQL: Introduction Lecture 2-3 (pdf)
Lecture 2 Notebook

Activities:
Activity 2-1 (soln)
Activity 2-2 (soln)
Activity 2-3 (soln)
Activity db
PS 1 Materials:
3 10/3 SQL: Advanced Lecture 2-3 (pdf)
Lecture 3 Notebook

Activities:
Activity 3-1 (soln)
Activity 3-2 (soln)
Activity 3-3 (soln)
Activity db
Ch. 6
Database Design and Normal Forms
4 10/5 Database Design: ER Diagrams Lecture 4 (pdf)

Activities:
Activity 4 (pdf)
Ch. 2 Project Part 1:
5 10/10 Database Design: Theory 1 Lecture 5-7 (pdf)

Activities:
Activity 5 (soln)
MVDs
Closure
Activity 3NF
Ch 3.2 - 3.7 PS 1 Due (before class)
6 10/12 Database Design: Theory 2 Lecture 5-7 (pdf)

Activities:
Activity 6-1 (soln)
Activity 6-2 (soln)
MVDs
Closure
Activity 3NF
PS 2 Materials:
Transaction Processing
7 10/17 Database Design: Theory 3 Lecture 5-7 (pdf) Project Part 1 Due (before class)
8 10/19 Transactions: A User's Perspective Lecture 8 and 11 (pdf) Ch 8.6
Midterm
9 10/24 Midterm Review Midterm Review (pdf) PS 2 Due (before class)
10 10/26 Midterm
Query Processing and Database Internals
11 10/31 Mechanisms for Transactions: Logging and Locking Lecture 8 and 11 (pdf)

Activities:
Activity 11-1
txn_viewer.py
txnViewer.js
Ch 18.1-18.4 Project Part 2:
12 11/2 I/O Cost Models and External Sort Lecture 12-13 (pdf) Ch 11.4
13 11/7 Indexing Lecture 12-13 (pdf)
Lecture 13 pdf

Activities:
Activity 13 (soln)
db file
Ch 13.1-13.3
14 11/9 Access Methods and Operators Lecture 14 (pdf) Ch 15 (except 15.9)
15 11/14 Joins Lecture 15 (pdf)

Activities:
Activity 15
External Merge Sort
compModel.js
display_tools.py
io_backend.py
Ch 2 and 16.3 Project Part 2 Due (before class)
Project Part 3 and Pset 3 Released

Project Part 3:
Pset 3:
16 11/16 Relational Algebra Lecture 16 (pdf)

Activities:
Activity 16-1
display_tools.py
relation_algebra.py
act-16-1.png
Ch 2 and 16.3
Thanksgiving Recess: 11/20-11/24
17 11/28 Query Optimization
Advanced Topics
18 11/30 NoSQL Systems Pset 3 Due (before class)
19 12/5 Distributed Data Processing
20 12/7 Final Exam Review Project Part 3 Due (before class)
Midterm Exam
The midterm exam will be on Oct 26th from 3:00pm-4:20pm (during class time).
Final Exam
The final exam will be on December 12th at 3:30pm.
Grading
Problem Sets25%
Programming Project25%
Midterm20%
Final30%
Office Hours

Unless otherwise specified in the staff section below, office hours will be held in the open area of the Huang basement. CAs will bring signs to identify themselves. Please see the staff section below for office hours.

Note: the schedule of office hours may change from time to time, in which case an announcement will be made on the course Piazza.

Staff
Please use Piazza to contact the course staff!
Peter Bailis
Tara Balakrishnan (taragb@stanford.edu)
Aarti Bagul
Dev Bhargava
William Chen
Soroosh Hemmati
Woncheol (Dennis) Jeong
Simon Kim
Parth Shah
Lingtong Sun
Stephanie Tang
Amelia Vu
Victoria Wang
Hao Wu
OH Schedule
Late Policy
You will have six 24-hour "late days" that you can use throughout the quarter on any of the Problem Sets or Programming Projects, unless specified otherwise. Beyond these six late days, we will only grant extensions in the case of a severe medical or family emergency. Please use your late days wisely.
You can use all six late days on each assignment except the last one. You will only be able to use 2 late days on the last assignment - and it must be submitted by 11:59pm on the Friday of dead week (12/8).
Honor Code and Collaboration Policy

We encourage you to discuss the Programming Projects and Problem Sets with other students; it's fine to discuss overall strategy and collaborate with a partner or in a small group, as both giving and receiving advice will help you to learn.

However, for the Programming Projects, you must write your own code: it's not OK to share code or write code collaboratively. (This includes posting and/or sharing your code publicly, such as on GitHub!) Likewise, for the Problem Sets, you must write up your own solutions to all of the problems, and you must cite all people you worked with. If you do not do so, we will consider this a violation of the Stanford Honor Code.

If you consult any resources outside of the materials provided in class, you must cite these sources. We reserve the right to assign a penalty if your answers are substantially derivative, but, as long as you provide appropriate citations, we will not consider this an Honor Code violation.

Students with Documented Disabilities
Students who may need an academic accommodation based on the impact of a disability must initiate the request through the Office of Accessible Education (OAE). OAE staff will evaluate the request with required documentation, recommend reasonable accommodations, and prepare an Accommodation Letter for faculty dated in the current quarter in which the request is being made. Students should contact OAE as soon as possible since timely notice is needed to coordinate accommodations: 563 Salvatierra Walk; phone: (650) 723-1066.
Feedback
Please provide feedback to Peter and/or any of the course staff via Piazza, or anonymously via the this form, which only Peter can access.