Improving code

Good afternoon everyone!

I have this assignment that is due in 3 days from today:

  1. Let’s say that someone has asked us to create a chart of the number of projects created each month. The dataset projects has two columns: project_id, a unique identifier for each project, and created_at, a timestamp that goes down to the second (e.g., 2016-07-14 20:35:13).

Read over the following SQL code used to produce the chart. Note any errors and/or other changes you would make to improve it.

DATE_TRUNC(‘month’ FROM created_at) AS month
COUNT(DISTINCT project_id) AS num_projects
FROM projects

Bonus: Using your improved result from the previous question, write a query that adds a new column telling us the percentage of all projects that each month represents. (For example, if there are 100 projects total, and 10 of them were created in August 2020, then that row will have a value of 10%.)

I am stuck with this. Do I create the chart by using the CREATE clause and then list the columns or do I use the SELECT clause and just input the provided information?

Thanks everyone!

Hello @java6407201703, welcome to the forums! As this seems to be an assignment, unfortunately, we can’t help you here on the forums, unless you have express permission from your teacher/professor.