CS145 Project Part 4

CS145 - Introduction to Databases
Spring 2000, Prof. Widom

Personal Database Application: Part 4
Due Monday May 1

In this part of the project, you will issue SQL queries and updates against your PDA database, and you will experiment with the use of indexes and transactions. Since you will be modifying your data as part of this assignment, you may want to establish some kind of routine that includes reloading your database from the files you created for PDA Part 3 each time you want to get a "fresh" start. Remember to delete the contents of each relation (or destroy and recreate the relations) before reloading, as Oracle will happily load your data a second time, doubling the size of your database.

  1. (SQL)
    Develop and test:

    (a) At least eight SQL data retrieval (select) commands.

    (b) At least two each of the four types of SQL data modification commands: insert a single tuple, insert a subquery, delete, update.

    Please note:

  2. (Indexes)
    In Problem #1 you may have discovered that some queries run very slowly over your large database. As discussed in class, an important technique for improving the performance of queries is to create indexes. An index on an attribute A of relation R allows the database to quickly find all tuples in R with a given value for attribute A (which is useful when evaluating selection or join conditions involving attribute A). An index can be created on any attribute of any relation, or on several attributes combined. The syntax for creating indexes in Oracle is given in the handout Oracle 8i SQL. Please pay careful attention to the information about Stanford/Oracle-specific syntax.

    Create at least three useful indexes for your PDA. Run your queries from Problem #1 on your large database with the indexes and without the indexes. Turn in a script showing your commands to create indexes, and showing the relative times of query execution with and without indexes.

    Please note:

  3. (Transactions)
    This is a trivial problem to exercise transaction support in Oracle. Since it would be difficult for you to simulate multiple users operating on your database, you will simply experiment with the properties of transaction commit versus rollback.

    (a) Show a session in which you perform one or more data modification commands, then commit the transaction using "commit;". Issue queries before and after executing the transaction to demonstrate that the modification has been made on the database.

    (b) Now show a session in which you perform one or more similar data modification commands, but then abort the transaction using "rollback;". Issue queries before and after executing the transaction to demonstrate that the modification has not been made on the database.

Turning in Scripts

A script must be turned in on paper (no email submissions) demonstrating that you've performed the assignment as specified above. It is an Honor Code violation to edit scripts before turning them in, and as usual we will pursue aggressively all suspected cases of Honor Code violations.

Additional notes: