CS 145 - Introduction to Databases
Course Information

Course Content

This course provides the student with an introduction to the design of databases and the use of database management systems for applications. We will cover object-oriented (O/O) and entity-relationship (E/R) approaches to database design. We will cover the relational data model, mappings from O/O and E/R designs to relations, relational design issues, and how one uses a relational database management system to implement a database. Abstract query languages such as relational algebra will be discussed, along with extensive coverage of SQL--the standard language for creating, querying, and modifying relational databases. We will cover a variety of other issues important to database designers and users, including views, integrity constraints, triggers, transactions, and security. Finally, time permitting, we will consider advanced database management features such as logic-based query languages, object-oriented query languages, and object-relational systems.

This course is aimed at database design and use, and the implementation of database applications. It does not cover the implementation of database management systems. This topic is covered in the follow-on courses CS 245A and 245B.

Time and Place

Mondays and Wednesdays 11:00-12:15, Gates B01 (Hewlett-Packard Auditorium)

Course Personnel

Instructor Jennifer Widom
Office: Gates Building Rm. 422
Phone: 723-7690
Office hours: Mondays and Wednesdays 10:00-11:00
T.A.s Oliver Duschka and Dan Liu
Office locations, phones, and hours: TBA
E-mail: cs145ta @ cs.stanford.edu
Secretary Sharon Lambeth
Office: Gates Building Rm. 419
Phone: 725-3358
E-mail: lambeth @ db.stanford.edu


CS 107 Programming Paradigms
CS 109A,B Introduction to Computer Science

Course Reader and Optional Books

The primary reading material for the course is an extensive set of notes available in the Stanford Bookstore. These notes are a draft of a book by Jeffrey D. Ullman based on CS 145. If you have comments or corrections on the manuscript please send them directly to Prof.\ Ullman: ullman @ db.stanford.edu.

If you feel uncomfortable without a hard-cover textbook, the following book can be used to supplement the notes, although it is neither required nor necessary:

You will be using SQL extensively in your programming assignments. Although there's SQL documentation at Sweet Hall, good on-line help facilities, and extensive coverage of SQL in the course reader, you may find it helpful to have a book devoted exclusively to SQL. Two recommended books are:

One copy of each of the recommended books will be on reserve at the Math and Computer Science library.


There will be eight assignments, which will include a mixture of written work and database programming. Assignments will be given on Wednesdays and will be due the following Wednesday. There will be an assignment due every full week except the first one and the week of the midterm exam. You can, if you like, discuss the assignments with the TAs, the instructor, or other students. However, you must write and fully understand your own original answers and programs for each assignment.

Late Policy

On-campus students: Assignments are due at 5:00 PM on Wednesdays. Late assignments received by 12:00 noon on Friday will be penalized 33%. Assignments will not be accepted after noon on Friday. Assignments should be turned in during class or at the course secretary's office: Gates Building room 419.

SITN students: Assignments due on Wednesday must be timestamped by the Thursday morning courier. Late assignments timestamped by the Friday morning courier will be penalized 33%. Assignments timestamped later than Friday will not be accepted. Assignments not sent by SITN courier are subject to the late policy for on-campus students specified above.

This late policy will be strictly enforced.


The midterm exam will be held on Monday November 4 in class at the regular time. The final exam will be held on Monday December 9 at 8:30 AM (location to be announced). Alternative or make-up exams will not be given. All on-campus and SITN students must attend the midterm and final exams on the Stanford campus at the scheduled time and place.


Assignments 50%
Midterm exam 20%
Final exam 30%

All students are expected to obey the Stanford Honor Code for all assignments and examinations. Any suspected Honor Code violation, no matter how minor, will be taken very seriously and will be handled through official University channels.

Q&A Session

There will be a question-and-answer session held each Tuesday from 12:00-12:50 in Terman 156. It will be televised live to SITN students on channel E3. The session will be conducted by one of the TAs and is entirely optional. During the session, the TA will answer student questions or work problems posed by the students, but the TA will not deliver a prepared lecture. If you attend the session (live or via television), please come armed with questions or discussion points.


All e-mail regarding the course should be sent to cs145ta @ cs.stanford.edu or to the course secretary lambeth @ db.stanford.edu. Please do not send messages to individual TAs or to the instructor. Messages for individuals or for the instructor will be forwarded appropriately.

Web Page, FTP Access, and Newsgroup

The course web page is located at URL:

All handouts that are available on-line will be linked to the web page in postscript format. The same postscript files will be available in course directory /afs/ir/class/cs145/handouts. This directory also is available by anonymous ftp to ftp.stanford.edu as /class/cs145/handouts. In addition to handouts, the web page will contain other useful information regarding the course, such as a list of frequently-asked questions.

The course newsgroup is:

The newsgroup is accessible from any Unix machine on campus. If you need help using newsgroups, you can refer to the ``Introductory Guide to trn'' available at the consulting desk on the second floor of Sweet Hall, to the file ~ consult/pub/news/trn on Leland machines, or to URL http://consult.stanford.edu/cpub/news/trn. Please check the course newsgroup frequently--we will assume that all students are reading the newsgroup at least every couple of days, and we will not hesitate to make important announcements via the newsgroup. If you are unable to read the newsgroup for some reason, please let the TAs know as soon as possible. To post a message on the newsgroup of general interest to the entire class, send the posting as a mail message to su-class-cs145 @ news.stanford.edu.


On the fourth floor of the Gates Building (turn left when you come out of the elevators) there's a file cabinet with a drawer marked ``CS 145''. In this drawer we'll leave any extra copies of the handouts, along with all graded assignments and exams not picked up in class. We will not restock handouts in the file cabinet, so if you can't find a handout there you should obtain it from the web or via ftp.


Programming assignments will use the Sybase relational database management system (version 11.0.1) and the C or C++ programming language. Sybase and C/C++ are available on the Sun ``elaine'' workstations running Solaris (version 2.5.1). These machines are located on the second floor of Sweet Hall. To open an account on these machines, type open at the login: prompt and follow the instructions.

Directory /afs/ir/class/cs145 (also accessible as /usr/class/cs145 from Leland machines) will contain files and subdirectories for the class. We will assume that students are proficient already with Unix and C. (C++ is not required, but it is allowed for those who prefer to use it.) For Unix and C novices, basic information about common Unix commands and C compiling will be provided in the subdirectory /afs/ir/class/cs145/HELP/. Sybase manuals are available for reference at Sweet Hall.

SITN students can access the Sun workstations remotely via dial-in or telnet. If you have access to a Unix workstation at your site, including a full-fledged relational database management system (such as a recent version of Sybase or Oracle) that has an SQL interactive interface and a C application programming interface, then you may use your workstation. However, we will not make any exceptions for problems incurred by using your own computing facilities rather than those provided by Stanford.

Tentative Syllabus

Week Date Topic Reading in Course Notes
1 Sep. 25 Intro. to course and subject 1.1-1.4
2 Sep. 30 Object-oriented database design 2.1, 2.3-2.5
Oct. 2 Entity-relationship model 2.2-2.6
3 Oct. 7, 9 Relational model 3.1-3.4
4 Oct. 14 Relational algebra 4.1
Oct. 16 SQL 5.1-5.7
5 Oct. 21 SQL (cont'd)
Oct. 23 Indexes, Programming with SQL 5.7, 7.1, 7.3
6 Oct. 28 Constraints and triggers 6.1-6.6
Oct. 30 Views, midterm exam review 5.8
7 Nov. 4 Midterm exam
Nov. 6 Transactions 7.2
8 Nov. 11 Security 7.4
Nov. 13 Relational database design 3.5-3.8
9 Nov. 18 Relational database design (cont'd)
Nov. 20 Datalog 4.2-4.4
10 Nov. 25 Advanced SQL 5.9-5.10
Nov. 27 OQL 8.1-8.4
11 Dec. 2 Object-relational SQL3 8.5-8.7
Dec. 4 Final exam review
12 Dec. 9 Final exam

The TAs of CS145, cs145ta @ cs.stanford.edu, last modified: 10/01/96