CS 235: Assignment 4

Due in class, Wednesday, May 9, 2007


PDA: Part 4

The fourth part of the PDA project is to run some interesting queries involving aggregation and add constraints to your database schema.
  1. Develop and test at least six SQL queries involving aggregation. For example, if your application is a dating site you can compute:

    Turn in a copy of all of your SQL commands, along with a script illustrating their execution on your large database. Your script should be sufficient to convince us that your commands run successfully, but you can and should truncate query results after a few lines. Please do not turn in query results that are hundreds of lines long.

  2. Modify your database schema declarations to include all different types of constraints that we covered in class:

    For each trigger and any complicated attribute-based constraint include a one or two sentence explanation. Note that you can use triggers to implement standard attribute checks.

    Here are some examples constraints if your application is a dating site:

    As usual, turn in the file with your modified database schema declarations and a script showing a MySQL session in which your relations are created successfully.

  3. Repopulate your database using your real data. Are there any constraint violations? If so, explain why they happened, e.g., your real data may be incomplete or inconsistent, or you may have over-constrained your database.

    Turn in a script that shows the loading of your data into MySQL.

  4. Repopulate your database using your fabricated data. Are there any constraint violations? If so, modify your data-generating program and generate new fabricated data that conforms to all of your constraints.

    Turn in a script that shows the loading of your "original" fabricated data into MySQL and a script that shows the loading of your "new" fabricated data.

Problem Set

  1. Problem 6.1.6 from the textbook.

  2. Problem 6.2.2 (c)-(f) from the textbook.

  3. Problem 6.4.7 (e)-(g) from the textbook.

  4. Problem 6.5.1 (b),(g) from the textbook.