Tutorial 3: Relational Algebra - PowerPoint PPT Presentation

1 / 5
About This Presentation
Title:

Tutorial 3: Relational Algebra

Description:

We know that natural join is not a basic operator in relational algebra. ... Write a relational algebra query to find the acc-id of every account whose ... – PowerPoint PPT presentation

Number of Views:36
Avg rating:3.0/5.0
Slides: 6
Provided by: marily192
Category:

less

Transcript and Presenter's Notes

Title: Tutorial 3: Relational Algebra


1
Tutorial 3 Relational Algebra
2
  • Question
  • We know that natural join is not a basic
    operator in relational algebra. Hence, there must
    be away to replace it with an equivalent
    expression involving only basic operators. Next
    we will see how to do this.
  • Given R (A, B, C, D) and S (E, B, D), rewrite
    R S into a relational algebra expression
    involving only ?, s, and .

3
  • Question
  • OWNS(acc-id, cust-id)
  • ACC(acc-id, balance).
  • Write a relational algebra query to find the
    cust-ids of the owners of all accounts with
    balances at least 10k.

4
  • Question
  • OWNS(acc-id, cust-id).
  • ACC(acc-id, balance).
  • Write a relational algebra query to find the
    acc-id of every account whose balance is larger
    than all the accounts owned by the customer with
    cust-id C1.
  • Note If your query is too complex, you can cut
    it into multiple steps by using the assignment
    operator ?.
  • For example, A ?scust-idC1(OWNS) defines a table
    A that is the result of the selection. Then, you
    can use A directly in the subsequent expressions.
    For example, ?acc-id (A) projects A onto column
    acc-id.

5
  • Question
  • DEPOSIT(acc-id, cust-id, amount).
  • Write a relational algebra query to find all the
    cust-id of all those customers that touched all
    the accounts touched by the customer with cust-id
    1.
  • Touch means depositing into the account.
Write a Comment
User Comments (0)
About PowerShow.com