In Postgres, we want to use the window function as an aggregate function. We have a table, where every line consists of two timestamps and a value. W ...
In Postgres, we want to use the window function as an aggregate function. We have a table, where every line consists of two timestamps and a value. W ...
I have a MS SQL Server database for a restaurant. There is a transactional table that shows the meals ordered and, where applicable, the optional (cho ...
I receive an error(ERROR: syntax error at or near "`INTERSECT`") in the SQL query, can someone help me to fix it? The query is below: Thanks in ad ...
I hope someone can help. Suppose I have this table id actual_date target_date qty 1 2022 ...
In PostgreSQL, I have 2 tables: Users (UserID (PK int), UserName (character varying)) Visits (VisitID (PK int), UserID (FK Users, int), VisitDat ...
I have the first three fields of the following table. I want to compute the number of consecutive days an amount was higher than 0 ("days" field). ...
Lets say I have this kind of data I want to make some kind of additional rows, and after that make new column based on this additional rows My exp ...
I have a table with an item, its cost and the date it was added. I need to create a new table with the following fields: "item_id", "item_nam ...
app_id status modified_date 1 A 2022-10-23 1 B 2022-10-10 ...
I have the query below which I am trying to rewrite. I have tried window functions and OUTER APPLY but it is difficult for me to get the logical meani ...
So I have a SQL query that is returning multiple rows with null value, I want to duplicate value and get rid off all now. What is the best way to do t ...
I have the following table With the following data sample for a single tournament / year / round-combination. I would like to create a new colum ...
I have a table like date ticker Action '2022-03-01' AAPL BUY '2022-03-02' ...
I have a table like: Id type status 1 coach 1.0 2 coach True ...
I have this table in redshift I want to write a query which supposed to get the first and last row based date_status and also row_ant for each no ...
DB-Fiddle Expected Output: stock_date inbound_quantity outbound_quantity balance 2020-01 ...
I have a table source_flight_destination like this ID Flight source destination 1 Indigo ...
Im looking to sum a column until a defined value then ignore the rest of the records. ID WHEN VALUE AVG_COL ...
Outer Join 'fill-in-the blanks' I have a pair of master-detail tables in a PostgreSQL database where master table 'samples' has some samples with a t ...