The following simple database has been designed to keep trac

The following (simple) database has been designed to keep track of customers and outstanding foans. Some sample data has been entered into the database Account: Account ype ame Rate Terms Private 10.00% 30 B Corporate 7.00% 60 C Preferred 5.00% 90 Customer: CustomerID FirstName LastName AccountType DateAcquired Barney 1123 Rubble 4/1/00 1234 Bugs Bunny B 4/4/DO 2134 Fred Flintstone B 12/1/99 2233 Herman Munster A 3/5/90 3324 George Jetson C 3/30/93 3333 Hiswife A 3131/93 Jane Loan: DistributionDate CustomerID LoanAmount LoanID $500.00 120 3/10/00 1234 121 4/4/00 2233 S10,000.00 122 $500.00 3/14/00 1234 123 $1,000.00 3/15/00 1123 1. Using the above tables, show exactly what would be produced by the following SQL statement: SELECT LastName, DateAcquired FROM Customer WHERE Accountlype \"A ORDER BY LastName; 2. Using the above tables, show exactly what would be produced by the following SQL statement: SELECT LastName, DateAcquired FROM Customer INNER JOIN Loan WHERE AccountType \"A

Solution

1. SELECT LastName, DateAcquired FROM Customer WHERE AccountType = \"A\" ORDER BY LastName;

HisWife 3/31/93

Munster 3/5/90

Rubble 4/1/00

2. SELECT LastName, DateAcquired FROM Customer INNER JOIN Loan ON Customer.CustomerID = Loan.CustomerID WHERE AccountType = \"A\" ORDER BY LastName;

Munster 3/5/90

Rubble 4/1/00

3. SELECT LastName, DateAcquired FROM Customer LEFT JOIN Loan ON Customer.CustomerID = Loan.CustomerID WHERE AccountType = \"A\" ORDER BY LastName;

HisWife 3/31/93

Munster 3/5/90

Rubble 4/1/00

4. Display a list of all customer first and last names in order by the date they were acquired, starting with the most recent.

SELECT FirstName, LastName FROM Customer ORDER BY DateAcquired DESC;

 The following (simple) database has been designed to keep track of customers and outstanding foans. Some sample data has been entered into the database Account

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site