Company also likes to find out the total purchase amount and the number of transactions made by each customer in their lifetime Create new data frame called "new-dataset", containing the columns ['CustomerID', TotalPurchaseAmount', NumberofTransactions']. Display the last 10 rows. Expected output is as follows:
SQL
SQL stands for Structured Query Language, is a form of communication that uses queries structured in a specific format to store, manage & retrieve data from a relational database.
Queries
A query is a type of computer programming language that is used to retrieve data from a database. Databases are useful in a variety of ways. They enable the retrieval of records or parts of records, as well as the performance of various calculations prior to displaying the results. A search query is one type of query that many people perform several times per day. A search query is executed every time you use a search engine to find something. When you press the Enter key, the keywords are sent to the search engine, where they are processed by an algorithm that retrieves related results from the search index. Your query's results are displayed on a search engine results page, or SER.
![Task-6:
Company also likes to find out the total purchase amount and the number of
transactions made by each customer in their lifetime
Create new data frame called "new-dataset", containing the columns
['CustomerlD', TotalPurchaseAmount', NumberofTransactions']. Display the
last 10 rows. Expected output is as follows:
CustomeriD TotalPurchaseAmount NumberofTransactions
6
15100
350.40
7
15291
328.80
15311
454.63
36
16029
3702.12
8
10
16098
430.60
12
11
16250
226.14
14
12
17420
130.85
7
13
17809
34.80
1
14
17850
725.44
45
15
18074
489.60
13](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F0c1faf28-6598-4562-87ec-f26a5152e57c%2F7f9c927a-abcd-4ad3-8bd7-36a7f2912497%2Fs0ureff_processed.jpeg&w=3840&q=75)
![In (45):
1 Datal.head (200)
Out[45]:
InvoloeNo stookCode
Desoription Guantity
InvoloeDate UnitPrioe Cuctomerio
Country
536365
85123A
WHITE HANGING HEART T-LIGHT HOLDER
01/12/2010 826
2.55
17850.0 Untad Kingdom
536365
71063
WHITE METAL LANTERN
O1/12/2010 826
3.39
17850.0 United Kingdom
2
53636G
844068
CREAM CUPID HEARTS COAT HANGER
01/12/2010 826
2.75
17850.0 Unted Kingdom
536365
84029G KNITTED UNION FLAG HOT WATER BOTTLE
01/12/2010 8:26
3.39
17850.0 Untad Kingdom
4
536365
84029E
RED WOOLLY HOTTIE WHITE HEART.
01/12/2010 826
3.39
17800.0 United Kingdom
186
536388
22469
HEART OF WICKER SMALL
12 01/12/2010 9.50
1.65
16250.0 Unted Kingdom
188
536388
22242
5 HOCK HANGER MAGIC TOADSTOOL
12 01/12/2010 9.59
1.65
16250.0 Unted Kingdom
187
536389
22941
CHRISTMAS LIGHTS 10 REINDEER
6 01/12/2010 10:03
8.50
12431.0
Australia
188
536389
21622
VINTAGE UNION JACK CUSHION COVER
8 O112/2010 10.03
4.95
12431.0
Australia
188
536389
21701
VINTAGE HEADS AND TAILS CARD GAME
12 01/12/2010 10:03
1.25
12431.0
Australia
200 rows x 8 columns
In (49):
1 Datal.tail(200)
Out[49]:
InvoloeNo atookCode
Decoription Quantity
InvolceDate UnitPrioe Cuctomerio
Country
641700
581667
22625
RED KITCHEN SCALES
2 0812/2011 11.56
8.50
16626.0 Unted Kingdom
641710
581067
23356
HOT WATER BOTTLE KEEP CALM
4 O9122011 11:06
4.95
16626.0 Unted Kingdom
641711
581567
21326 AGED GLASS SILVER T-LIGHT HOLDER
144 09/122011 11.56
0.55
16626.0 Unted Kingdom
641712
581567
21479
WHITE SKULL HOT WATER BOTTLE
4 O9122011 11:56
4.25
16626.0 Unted Kingdom
641713
581567
23356
LOVE HOT WATER BOTTLE
3 Ce122011 11.56
5.95
16626.0 United Kingdom
641B04
581587
22613
PACK OF 20 SPACEBOY NAPKINS
12 D9/122011 12:50
O.85
12680.0
France
641805
581587
22899
CHLDRENS APRON DOLLY GIRL
6 D9/122011 12.50
2.10
12680.0
France
641808
581587
23254
CHILDRENS CUTLERY DOLLY GIRL
4 Da/122011 12.50
4.15
12680.0
France
641807
5815I7
23256 CHILDRENS CUTLERY CIRCUS PARADE
4 D9/122011 12:50
4.15
12680.0
France
641803
581587
22138
BAKING SET 9 PIECE RETROSPOT
3 D/122011 12.50
4.95
12680.0
France
200 rows x 8 columns](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F0c1faf28-6598-4562-87ec-f26a5152e57c%2F7f9c927a-abcd-4ad3-8bd7-36a7f2912497%2Fkqilnaq_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 3 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
![Oracle 12c: SQL](https://www.bartleby.com/isbn_cover_images/9781305251038/9781305251038_smallCoverImage.gif)