Reputation: 317
I have the following schema
Persons (SSN, Name, HouseId, ApartmentNumber, Salary)
Houses (HouseID, HouseAddress, ApartmentCount, Color)
Landlords (LandlordID, OwnerSSN, LandlordAddress)
Ownerships (LandlordID, HouseID, PurchaseDate, PropertyTax)
Tenants (HouseID, ApartmentNumber, LeaseTenantSSN, LeaseStartDate, LeaseExpirationDate,
Rent, LastRentPaidDate, RentOverdue)
Find the names of all persons who lease an apartment whose rent is higher than half of that person’s salary. I am having a rough time with the English. Does it mean I have to find all people who are landlords and tenants and what they pay for rent is greater than half their salary?
Upvotes: 0
Views: 51
Reputation: 608
It sounds like a simple query:
select t.leaseTenantSSN from Tenants t join Person p on
t.LeaseTenantSSN=p.SSN where t.Rent > p.Salary*.5;
Upvotes: 1