Skip to content

Tag: sql

How to split and convert to pascal case oracle column names?

I want to selec column names and convert to pascal case. My column names are like this: IMG_SAR_NAME INT_AKT_DESC I want to split “_” names and convert to: ImgSarName IntAktDesc I can get column names with sql But can not convert to pascalcase. Answer I don’t know if always the underscore is…

How to use ‘between’ in CASE statement?

I need to select Shift from my production table such that if the time time is between 05:00 PM to 06:30 AM it is Shift B else its Shift A. The SQL that I have written is quite simple but does not gives me the expected results. The SQL is The Result I get is Shift_FK_ID 1 1 1 Where

Add on to an existing value in a field

In MySQL I would do something along the lines of I tried the following but after a bunch of searching I wasn’t able to find how to do the same in postgresql so my question is how would I go about adding a number to the previous value of a field (BIGINT) Answer You have to catch the value from

Complicated group by – windows

Can you please help with the following grouping: Name can have states that can be repeated several times and it is essential in output to have all the state changes over time and to have the starting date of the state Here is the input data: Desired output Answer Assuming you want to find the start date per c…