You are on page 1of 1

Data Management

Consider the following relations.




Customers(CustomerID, Name, City, zipCode)
Accounts(AccountID, CustomerID, Balance)
ransactions(ransID, AccountID, Date, Amount)
!ach relation has a candidate "ey including those underlined attri#utes(s). $rite SQL queries for
following re%uests.
a) &ind the CustomerID and name of each customer who li'es in Ir'ine, has a #alance at most
()****, and has a transaction with an amount at least (+**.
#) &ind the name and zipCode of each customer who does not ha'e any account. ,a'e them listed #y
zipCode from the highest to the lowest zipCode.
c) $rite an -./ assertion to encode the constraint0 1If a customer has an account with a #alance
greater than (+*,***, then the customer must ha'e A /!A- ) accounts.2
d) &ind the accountID of each account that has two different transactions on 3)43*4)**5.

You might also like