Assignment 3 (due Friday, Feb 2)

Part I

Provide a SQL file which performs the following operations.

  1. Declares the tables of the LIBRARY schema of Problem 7.23 in the textbook (pages 237-238).
  2. Populates the tables with entries which produce non-empty answers for the queries below
  3. Issues queries (a)-(g) of Problem 7.23

Part II

You will create another sql file to solve the following problem..
You are to create one table containing two attributes.
One attribute is the transaction identifier, the other is the
itemid. A tuple in this table represents the fact that a particular
item (itemid) was purchased during a given transaction.
First populate this database with the following 6 transactions:
  1. 1 4 5 7 8 9 2 3
  2. 2 5 9 4 6 3 0
  3. 0 4 8 6 7 2 1
  4. 1 9 5 7 6 4 3 2 8
  5. 3 4 5 6 7 8
  6. 9 2 4 6 7 8 5
Transaction 5 should be read as a transaction that
involves the purchase of items 3, 4, 5, 6, 7 and 8.
Next, write an SQL query (or a set of queries)
that will find all those co-occuring items
that co-occur greater than two times in the database
and store them in view called association_view.
You need to list the item pair and the number of times they co-occur in
the database. For instance the item-pair (0,4) appears only in
transactions 2 and 3 and therefore will not be listed.
However the item-pair (4,5) appears 5 times and will therefore
be selected. Note also that your resulting set of results should also only
select (4,5) once, i.e., (4,5) and (5,4) should both not appear in the
resulting view.
Notes