Skip to main content

RA: increase loans over 10000

Short answer

Remove loans with amt > 10000, apply generalized projection to multiply amt by 1.1, union with unchanged loans, and assign back to Loan.

Consider the relational schema: Acc (a_no, b_name, bal) Branch (b_name, b_city, assets) Customer (c_name, c_street, c_city) Loan (l_no, b_name, amt) Depositor (c_name, a_no) Borrower (c_name, l_no) Increase loan amount by 10% whose amt is greater than 10000. (Write a relational algebra expression.)

Relational algebra symbols used: σ select, π project, ⋈ natural join, ∪ union, ∩ intersection, − difference, ρ rename, 𝒢 aggregate.

Updating in relational algebra uses the generalized projection with an assignment: the tuples to be changed are removed, and their changed versions are added back.

Relational algebra expression

Loan ← ( Loan − σ amt > 10000 (Loan) )
        ∪ π l_no, b_name, amt * 1.1 ( σ amt > 10000 (Loan) )

Explanation

  1. σ amt > 10000 (Loan) selects the loans to change.
  2. Loan − (that set) keeps the loans that stay as they are.
  3. The generalized projection π l_no, b_name, amt*1.1 outputs the same loans with the amount increased by 10% (amt × 1.1 = amt + 10%).
  4. The union of the two parts is assigned back to Loan, so the relation now holds all the loans, with the large ones increased.

Example: a loan of 20000 becomes 22000; a loan of 9000 is unchanged.

An equivalent form uses a selection instead of the difference:

Loan ← π l_no, b_name, amt * 1.1 ( σ amt > 10000 (Loan) )  ∪  σ amt ≤ 10000 (Loan)

Equivalent SQL

UPDATE Loan SET amt = amt * 1.1 WHERE amt > 10000;

✓ Answer checked by Claude Opus 5.5 (high effort)

All Database Management System chapter 3 questions →