Interview Query

Percentage of Revenue by Year

Start Timer

0:00:00

Upvote
18
Downvote
Save question
Mark as completed
View comments (54)
Next question

You are generating a yearly report for your company’s revenue sources.

Calculate the percentage of all total revenue made to date that was made during the first and last years recorded in the table. Round the percentages to two decimal places

Example:

Input:

annual_payments table

Columns Type
amount INTEGER
created_at DATETIME
status VARCHAR
user_id INTEGER
amount_refunded INTEGER
product VARCHAR
id INTEGER

Output:

Columns Type
percent_first FLOAT
percent_last FLOAT
.
.
.
.
.


Comments

Loading comments