1 / 4

Schema BankWorld Customer( C_Name , C_Street, C_City) Depositor( Account_# , C_Name)

Schema BankWorld Customer( C_Name , C_Street, C_City) Depositor( Account_# , C_Name) Loan( Loan_# , B_Name, Amount) Borrower( C_Name , Loan_# ). Exercise: Select tuples of the loan relation where the branch name is “UTD” Find all tuples in which the amount of lent is more than $1200

Download Presentation

Schema BankWorld Customer( C_Name , C_Street, C_City) Depositor( Account_# , C_Name)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Schema BankWorld • Customer(C_Name, C_Street, C_City) • Depositor(Account_#, C_Name) • Loan(Loan_#, B_Name, Amount) • Borrower(C_Name, Loan_#)

  2. Exercise: • Select tuples of the loan relation where the branch name is “UTD” • Find all tuples in which the amount of lent is more than $1200 • Find those tuples pertaining to loans of more than $1200 made by “UTD” branch • List all loan numbers and the amount of loan • Find the names of all customers who live in “Dallas” • Find the names of all bank customers who have either an account or a loan or both • Find the name of all customers of the bank who have an account but not a loan • Find the name of all customers who have both a loan and an account

  3. Express the following query using SQL: 1.Sailors X Reserves 2.Sailors sailors.id < reserves.id Reserves 3.Sailors sailors.id = reserves.id Reserves 4.Sailors  Reserves 5.Find the names of sailors who have reserved boat 103 6.Find the names of sailors who have reserved a red boat 7.Find the colors of boats reserved by Dustin 8.Find the names of sailors who have reserved at least one boat 9.Find the names of sailors who have reserved a red or a green boat 10.Find the names of sailors who have reserved both a red and a green boat 11.Find the names of sailors with age over 20 who have not reserved a red boat 12.Find the names of sailors who have reserved at least two boats 13.Find the sids of all sailors who have reserved red boats but not green boats 14.Find sailors whose rating is better than some sailor called Smith 15.Find sailors whose rating is better than every sailor called Smith 16.Find the names of sailors who have not reserved a red boat 17.Find the average age of all sailors 18.Find the average age of sailors with a rating of 10 19.Find the name and age of the oldest sailor 20.Count the # of sailors 21.Find the names of sailors who are older than the oldest sailor with a rating 10 22.Find the age of the youngest sailor for each rating level 23.Find the age of the youngest sailor who is eligible to vote ( i.e., at least 18 years old) for each rating level with at least two such sailors 24.For each red boat, find the number of reservations for this boat 25.Find the average age of sailors for each rating level that has at least two sailors Find the average age of sailors who are of voting age (i.e., at least 18 years old) for each rating level that has at least two sailors

More Related