CS240A Winter
2002
|
Assignments for Week 1
- Study Sections 8.1--8.7 of textbook.
- Read the LDL++ tutorial, up
to Negation and Stratification (included).
- Do Exercises 8.1, 8.2, 8.6, 8.7, 8.8 from textbook.
Assignments for Week 2
- Study Sections 8.10, 9.1, 9.2, and 9.3 of the ADS textbook (proofs
are not needed)
- Using the tables/facts in example1.fac of the LDL++ tutorial write
the following two programs:
- Write an LDL++ program to find the pair(s) of cities in Texas
which are closest in distance. (You can express this query using
stratified negation.)
- Write an LDL++ program to add up the population of cities grouped
by state. (I.e., same as: select STATE, sum(POPULATION) from CITY
group by STATE. Here you need recursive rules that exploit the lexicographic
order of city names for each state.)
- Do Exercises 9.1 in ADS textbook.
Solutions for Exercises
8.1, 8.2, 8.6, 8.7, 8.8 and
9.1
Assignments for Week 3
- Study introduction of section 9.5 and subsections 9.5.1 and 9.5.2
of the ADS textbook
- Do exercises 9.3, 9.4, and 9.5 from ADS textbook (in Datalog only
not in Prolog).
- Show how the programs that you wrote for Exercises 9.3 and 9.4 are
rewritten by the compiler.
- [Given the city/distance database from the LDL++ tutorial--see last
week assignments] Write a recursive SQL query to compute the shortest
distances between pairs of cities (paper and pencil exercise no actual
programming on DB2, yet).
- Read Section 5.8 of DB2 book
- Express in LDL++ the recursive queries at pages 253 and 262 of the
DB2 book.
- Read Section 7.1 of DB2 book
- Read Sections 2.1 and 2.2 of ADS book.
Assignments for Week 4
- Study sections 2.3 and 2.5 from the ADS book.
- Study sections 3.1, 3.2, 3.3 and 3.4 from the ADS book.
- Study sections 7.2, and 7.3 from the DB2 book.
- Do Exercise 2.1, a-c, in ADS (skip part d).
- Write DB2 rules for the efficient (i.e., differential) support of
a transitive closure of a directed graph stored as a binary relation.
- Consider only inserts and deletes and see when it is possible
to avoid writing recursive rules using the "for each row" option.
- First solve the case where the graph is actually a tree (e.g.,
a management hierarchy) or a forest.
- Then, see if you can also solve the general case.
Solutions for Exercises
9.3,
9.4, 9.5
Assignments for Week 5
- Study section 4.1 of the ADS book.
- Study sections 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, and 5.7 from the DB2
book.
- Write and efficient SQL statement for the query at page 236 of the
DB2 book without using the Super Group features (hint: use table expressions
instead)
- Do the following exercises:
Assignments for Week 6
- Study Chapter 5 of ADS textbook till page 113.
- Study Chapter 6 of ADS textbook.
- Do exercises 6.1 and 6.3 in the ADS textbook.
- You have a traditional employee relation EMP(Eno, Sal, Title).
The concrete view EHist(Eno, From, To) keeps the transaction time history
for the EMP relation, and must be maintained by active DB2 rules.
Please, write those rules.
- Find out what the origin of expressions such as "blue
moon" and "honey
moon."
Does the word `moon' in those expressions denote the celestial body
or a lunar month?
- Explain how the one or two leap seconds that can be introduced each
year by the International Earth Rotation Service has affected the TIME
data type of SQL.
Solution
for week 4: (support of a transitive closure of a tree/graph stored
as a binary relation)
Solutions
for week 5.
Solutions
for week 6. Also answers to the "blue
moon" and "honey
moon" questions.
Sample
questions from previous midterms
Assignments for Week 7
- Study Notes on spatial access methods, and prepare for midterm
Assignments for Week 8
- Study Notes on classifiers
- Familiarize yourself with DB2
- [Given the city/distance database from the LDL++ tutorial--see previous
assignments] Write a recursive DB2 query to compute the shortest distances
between pairs of cities (turn in code and printout of an actual example).
- Given a relation such as emp(ENo, Salary), see if you can
come up with a simple way to compute the median salary using SQL and/or
DB2.
Assignments for Week 9
Week 9
Midterm Correction
|