COMP_SCI 339: Intro to Databases



Students must have completed COMP_SCI 214 & (COMP_SCI 213 or COMP_ENG 205), or be CS Grad students (MS or PhD) in order to register for this course.


Data models and database design. Modeling the real world: structures, constraints, and operations. The entity relationship to data modeling (including network hierarchical and object-oriented), emphasis on the relational model. Use of existing database systems for the implementation of information systems.

  • Spring Section: Students must be familiar with Java programming prior to taking this course.
  • This course satisfies the Systems breadth requirement.

COURSE INSTRUCTOR: Prof. Rogers (Winter & Spring) and Andrew Crotty (Spring)

COURSE COORDINATORS: Prof. Peter Dinda & Prof. Jennie Rogers


  • Hector Garcia-Molina, Jeffrey D. Ullman, Jennifer D. Widom, Database Systems: The Complete Book, 2nd Edition, Prentice Hall, 2009. (Prof. Dinda)
  • Ramakrishnan, Raghu and Johannes Gehrke. "Database management systems." 3rd Edition. New York: McGraw-Hill, 2002; ISBN-10: 0072465638, ISBN-13: 978-0072465631 (Winter & Spring; Prof. Rogers)


  • Joe Celko, SQL for Smarties: Advanced SQL Programming, 5th edition, Morgan Kaufman, 2014. (Useful) (Prof. Dinda)
  • Tom Christiansen, brian d foy, Larry Wall, Jon Orwant, Programming Perl, 4th Edition, O’Reilly and Associates, 2012. (Useful) (Prof. Dinda)
  • Familiarity with concepts from discrete math such as set theory (COMP_SCI 212/310 for example) (Winter & Spring; Prof. Rogers)
  • Object-oriented programming experience, preferably with Java (Winter & Spring; Prof. Rogers)
  • Background in using a source code revision control system, especially git (Winter & Spring; Prof. Rogers)

COURSE OBJECTIVES: This course introduces the underlying concepts behind data modeling and database systems using relational database management systems (RDBMS, specifically Oracle), the structured query language (SQL), and web applications (Perl DBI inCGI) as examples.  Students are also introduced to the internals of an RDBMS engine.


Students learn:

  • How to model domains and data using the entity-relationship model
  • How to design a normalized schema in the relational data model
  • How to implement schemas using SQL
  • How to keep data consistent and safe with using the ACID properties (transactions) of a modern RDBMS
  • How to query data using SQL
  • How to interface to a modern RDBMS from a modern programming language
  • How such interfaces are used to create web applications
  • How an RDBMS provides quick access to data using indices, and how indices are implemented
  • How an RDBMS manages storage and the storage hierarchy
  • How an RDBMS optimizes and executes queries using the relational algebra, the theoretical underpinning of database systems
  • How an RDBMS implements transactions
  • Current topics


  1. Introduction to database-backed web applications
    1. Web systems, CGI and other application models
    2. Introduction to Perl
    3. Introduction to SQL and ACID
    4. Waterfall versus spiral models of development
  2. Entity-relationship data model
    1. Design principles
    2. Referential integrity and other constraints
  3. Relational data model
    1. Schemas and keys
    2. Functional and multi-valued dependencies
    3. Normalization and normal forms
    4. Translating ER schemas to relational schemas
  4. Relational algebra
    1. Bags and sets
    2. Basic operators
    3. Joins
    4. Grouping
    5. Expressions and constraints (statements)
    6. Equivalent expressions and optimization
  5. SQL in depth
    1. Writing constraints
    2. Advanced data types
    3. Regular expressions
    4. Nulls and 3-valued logic
    5. Indices
    7. Transactions
    8. Triggers
    9. Security (access control, SQL injection attacks)
  6. Storage systems and records
    1. Disks and RAID
    2. Record layout / free space management
    3. Buffer management
  7. B-Tree indices
    1. B+Tree
    2. Query and join implementations
  8. Hash indices
    1. Extensible hashing
    2. Linear hashing
    3. Query and join implementations
  9. Bitmap indices
    1. Query and join implementations
  10. Brief introduction to transaction implementation
    1. Logging (undo, redo, redo/undo)
    2. Locking (deadlock, lock ordering, two-phase locking)


1. Entity-Relationship data model

2. Relational data model

3. Relational Algebra


  • Extending a database-backed web app 
  • Designing an implementing a database-backed web app
  • Implementing a component of an RDBMS


  • 50 % Projects
  • 10 % Homework
  • 20 % Midterm
  • 20 % Final