Skip to content

Tag: sql

Split row data base on timestamp SQL Oracle

Good day everyone. I have a table as below. Duration is the time from current state to next state. Timestamp State Duration(minutes) 10/9/2022 8:50:00 AM A 35 10/9/2022 9:25:00 AM B 10 10/9/2022 9:35:00 AM C … How do I split data at 9:00 AM of each day like below: Timestamp State Duration(minutes) 10/9/…

Group by days of a month in CockroachDB

In CockroachDB, I want to have such this query on a specific month for its every day: the problem is that I want it on my local date. What should I do? My goal is: “month, day, count, sum” as result columns for a month. UPDATE: I have found a suitable query for this purpose: Thanks to @histocrat f…

Is such a result possible with a query from an SQL database?

I want to fire a query to get such a result: Tables Schema I guess it’s not possible like that? I don’t have any experience with text-based databases, but I can well imagine that this can be achieved with a MongoDB. Because ultimately I want to have a js object at the end of the day. Answer Here&#…

Calculating Value Count and Percentage

I have a table Currently Enrolled The table is basically to get an idea of how many supporters, undecided, and opposition they were. Then once I get the count I wanted to then do another calculation to find out what that percentage was. Essentially what I want to be able to do is: Count the total number of su…