Skip to content

Tag: sql

postgresql – condition met in a time interval

I have the following table and I want to create the condition_met column. The condition_met column is my expected output. Condition_met is TRUE when type_id = 34 and within 5 seconds after this type_id, the client_id of type_id = 34 becomes also prospect_id. To say it differently: for each type_id = 34 the cl…

Find the number of employees working under a manager

I have three tables called branch,employee and manager structured like this I want to view the id of each manager and the count of the employees he has under his supervision like this I have made this so far that shows which branch each manager works on but i don’t know how to proceed with the counting.…

Get monthly sum/agv/max of a measurement from timestream

I am storing measurements in Timestream with the following attributes (example): Let’s assume these metrics are written one per day. How do I have to query the data in order to get a monthly sum on the request count metric for a specific domain? In order to get a sum for the whole time range queried I c…