Csc 8710, Deductive Databases and Logic Programming (Fall 2012)

Homework 2 (Due: September 17th - Monday)

Consider the following relational database scheme (primary key attributes are shown in CAPITAL LETTERS):
 
    drinker(DNAME)
    bar(BNAME)
    beer(RNAME,price)
    frequents(DNAME,BNAME)
    serves(BNAME,RNAME)
    likes(DNAME,RNAME)
where

frequents indicates the bars a drinker visits
serves indicates what beer each bar serves
likes tells which beers each drinker likes to drink.

Write and execute DRC, DLOG, RA, and OurSQL expressions to answer the following queries:

  1. Find bars that serve a beer that Clark likes.
  2. Find drinkers who frequent at least one bar that serves a beer they like.
  3. Find drinkers who frequent at least all those bars that Peter frequents.
  4. Find drinkers who frequent no bar that serves a beer they like.
  5. Find drinkers who frequent only bars that serve at least one beer they like.
  6. Find pairs of drinkers who frequent EXACTLY the same bars.
  7. Find the second costliest beer(s).
Sample database files are available at drinks

Submission Instructions

Run the following command on tinman.cs.gsu.edu server:
sudo handin8710 2 file1 file2 ...
Here 2 stands for assignment number. In the future this will be 3, 4, etc. For this assignment, please place all DRC queries in a single file named drc, all RA queries in a file named ra, OurSQL queries in a file named oursql, individual Datalog queries in separate files named q1, q2, etc. You may zip all these in one file hw2.zip and submit it as follows:
sudo handin8710 2 hw2.zip