The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 365 Weeks Ago |
| Questions Answered: | 1850 |
| Tutorials Posted: | 1850 |
Graduate in Biology and Nutrition, MBA Finance
Florida State University
Aug-2000 - Jul-2007
Ass. Relationship Manager
Penn-Florida
Mar-2009 - Feb-2016
Â
use AP;
Â
/*
1. For items in InvoiceLineItems table whose AccountNo is an even number like
150 or 574, use a CASE function to display their AccountNo,
InvoiceLineItemDescription, and DescriptionLength. Depending on the total
number of characters of the InvoiceLineItemDescription, each DescriptionLength
shows one of the following three strings:
Â
'Shorter than 10 characters', or
'Between 10 and 19 characters', or
'20 or more characters'
Â
Also sort your output by AccountNo.
Â
Hint: Use one of the operators listed on p.97 to determine if a number is an even
or odd number.
Â
Here is a sample output of first few lines:
Â
AccountNo InvoiceLineItemDescription DescriptionLength
--------- -------------------------- -----------------------------
150Supplies Shorter than 10 characters
160MVS Online Library Between 10 and 19 characters
160MSDN Shorter than 10 characters
160Quarterly Maintenance 20 or more characters
170Network wiringBetween 10 and 19 characters
400CICS Desk ReferenceBetween 10 and 19 characters
......
...
*/
Â
Â
Â
Â
Â
Â
/*
2. Display InvoiceLineItemDescription such that the one with the
longest first word is printed at top and no duplicate rows.
To verify your output, display the length of the first word of
InvoiceLineItemDescription in the second column as FirstWordLength.
Â
Hint: use string functions discussed in lecture.
Â
Here is a sample output of first few lines:
Â
InvoiceLineItemDescription FirstWordLength
-------------------------- ------------------
Propane-forklift16
International pkg.13
International shipment13
Publishers Marketing10
DiCicco's9
Quarterly Maintenance9
Telephone (Line 1)9
.....
...
*/
Â
Â
Â
Â
Â
Â
/*
3. The manager wants to have a report of detail information of all invoice line items
with the desired column title shown below. She wants the items to be listed based on
the AccountNo (a->z) and item with the highest amount within each account is printed
first (see sample output below). In case of same amount value, items should be printed
by their InvoiceID in ascending order.
Â
Finally, all items should be continuously and uniquely ranked from 1 within each account.
Â
----------------------------------------------------------------------------------------
Item Rank Account No Item Amount Invoice ID Item Description Invoice Sequence
----------------------------------------------------------------------------------------
.....
Â
1 57075.60 12Kinko's2
2 57058.40 12Office Max3
3 57041.80 74Coffee1
1 5722433.00 56Card deck1
2 5721575.00 47Catalog ad1
3 572600.00 95Books for research1
4 572579.42 98Catalog ad1
5 5729.95 16Monthly access fee1
6 5729.95 23Monthly access fee1
1 574856.92 15Property Taxes1
1 58050.00 12DiCicco's1
1 582503.20 105Bronco lease1
1 5897125.34 31Web site design1
.....
...
*/
Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â----------- -----------Tha-----------nk -----------you----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------.Pl-----------eas-----------e p-----------ing----------- me----------- on----------- ch-----------at -----------I a-----------m Â----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I