Replace NULL values per partition

I want to fill NULL values in device column for each session_id with an associated non-NULL value. How can I achieve that? Here is the sample data: +————+——-+———+ | session_id | step …

Using columns in window function that are not in Group By, I get : SQL compilation error: [COLUMN_A] is not a valid group by expression

I’ve seen a lot of questions about this error, the closest one (as it’s using window function) to my issue would be this one My issue is that I use columns in the windows function that are not …

Remove Null from For loop of ArrayList

I am currently converting an ArrayList to a String to send it to a DB so I can retrieve it on the other end and convert it back to an ArrayList later. My thought process is to convert it to a string …

Oracle several counts over partition

I have the below query which is outputting the below results: SELECT a, b, COUNT(1) count, round(RATIO_TO_REPORT(COUNT(1)) OVER() * 100, 2) perc FROM t1 WHERE condition1 GROUP …

Oracle display number of unique values for column combination

I have the below table C1 C2 C3 A1 A2 A3 B1 B2 B3 C1 C2 C3 C1 C4 C3 For each unique combination of C1 and C3, I would like to keep the first value in C2, but storing the count of unique elements …

Incorrect parameter count in the call to native function ‘str_to_date’

There is a table tab1: |creation_date | acc_num | status| |——————-|———————|——-| |31.03.2021 07:43:43| 11111111111111111111| deny | |31.03.2021 07:43:43| …

Postgresql – access/use joined subquery result in another joined subquery

I have a database with tables for equipment we service (table e, field e_id) contracts on the equipment (table c, fields c_id, e_id, c_start, c_end) maintenance we have performed in the past (table m,…

Calculate the number of unique strings with the date, with a possible error

In the select, I get rows from the table with time in the format TIMESTAMP. I want to count unique rows, BUT with a possible error of 1 second. In the example below, for example, 3 unique records (1 …

Oracle SQL Inserting multiple rows into a table while referencing 2 FK

I’m trying to insert values id_team_FK and id_location_FK which both come from the same table. For example id_team_FK = 4 and id_location_FK = 150. The problem is, id_team_FK must be a randomly chosen …

SQL result from table a but name from table b

My request is quiet simple however I can’t find it (maybe I can’t goolge correctly). I have Table A and Table B Table A: ID length 1 50 2 45 2 20 and Table B ID name 1 apple 2 orange I want …