Postgresql table manipulation

Viewed 29

I am very very new to databases and I need some help figuring out how to create a query that I need.

I have a table with columns: date, product_id, signal. There are only 5 products at the moment but can grow but will never be more than 15. Each product only takes up 1000-2000 rows and each product will only grow by one row per day. I am trying to figure out a query that will present the data as follows:

date product_name1 product_name2 product_name3
2022-01-01 0 (signal value of that day) 1 0
2022-01-02 2 3 1

I pretty much need a row for each date that will have each product_name as the column name and the values will be the signal of that day for that product.

Thanks in advance.

0 Answers
Related