Skip to content

Tag: sql

How to change my name into columns using sql

What is the best query to split name into columns? ie. if my name is VELOCITY in one column. How can i split it as Answer If you just have a single row then: Which outputs: CH V E L O C I T Y If you have multiple input rows then, from Oracle 12, you can use a LATERAL

Repeating JSON Aggregated Array with Row Limits

I have an Oracle 19 database with a JSON aggregated array which I need to cut off and repeat after a set number of rows, for example: …etc. Here’s some basic SQL to illustrate how my current dataset is put together: I need to push customer data to an API endpoint. Pushing 1 customer record at a ti…

PSQL: How to compare record to previous record (2 tables)?

I have two tables: 01_System_Log Records I need to create a view, where the records of the last request id (3) are compared with the previous (2). So far I made a view, where the most actual records are shown. I am not sure how to proceed, while in all compare examples, which I have found, only one table was

DB2 functions returning error SQL CODE 4743?

I’ve been trying to solve this issue now for a while. I have a table called Students like: I am using DBVisualizer right now to execute my statements, but I am trying to play around with something called LISTAGG() as a DB2 function: However, every time I try to run this, I get this error: And I have no …

SQL query to find user by it’s specific latest action

I have following db scheme below where all user actions are collected: The goal is to find all recently blocked users. So the expected result is to find 1 and 3 user ids since those users were recently blocked. I’ve tried to play with following SQL below, but still do not have good understending how to …