Question 1. Consider
the following relational schema, write expressions of relational algebra and
Datalog to answer the following queries
Product ( pid, name, price, category, maker-cid)
Purchase (buyer-sin, seller-sin, store,
pid)
Company (cid, name, stock price,
country)
Person(sin, name, phone number,
city)
1. Find the name of all products:
RA |
|
Datalog |
|
2. Find the
countries of all the companies
Datalog |
|
3. Find all purchases with the same buyer and seller:
RA |
|
Datalog |
|
4. Find all products over $99.99:
RA |
|
Datalog |
|
5. Find all English companies (country=England) with stock prices
less than $100
Datalog |
|
6. Find the names of all products over $99.99:
RA |
|
Datalog |
|
7. Find store names where Fred bought something:
RA |
|
Datalog |
|
8. Find names of people who bought from “Gizmo Store”
Datalog |
|
9. Find SINs of people who bought products in the “computers” category.
Datalog |
|
10. Find the sin of people who
bought Canadian products
Datalog |
|
Get Free Quote!
428 Experts Online