I am trying to get a list of all of our users’ IPv4 addresses in a Clickhouse Table. Since some of our users have multiple IPv4 addresses separated by a comma, I created this query: but it gives me this error: Nested type Array(String) cannot be inside Nullable type. is it possible to only select a port…
Tag: sql
Determine if an event happened every hour for 24 straight hours
Edit – I am still digesting the great responses and learning how they work, awesome knowledge! Using SQL Server 2016, I am trying to figure out if any users have done something at least once every hour, for 24 consecutive hours. I have a table similar to this, in the example below, the only user who qua…
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
is there a method to conect to postgresql (dbeaver ) from pyspark?
hello i installed pyspark now and i have a database postgres in local in DBeaver : how can i connect to postgres from pyspark please i tried this but i have an error Answer You need to add the jars you want to use when creating the sparkSession. See this : https://spark.apache.org/docs/2.4.7/submitting-applic…
SQL – How to calculate product discount and get products where discount is greater than 25?
I want to calculate discount in SQL query and want to get products having discount greater than 25. I am trying with following query. Please correct me what i am doing wrong. Thank you I am getting following error. #1054 – Unknown column ‘p_discont’ in ‘where clause’ Answer use i…
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
PostgreSQL generating missing records and group them with source table
I’m creating a PostgreSQL query and I’d like to have the missing records for each day filled in automatically. It occurred to me that I could generate a table that contained zero values and then join a source table to it. So I created this query, but the result still does not contain missing days,…
oracle sql – get difference between 2 dates (sysdate minus the datevalue of a other table)
I want to know the difference betweeen 2 dates. I need something like this: “sysdate minus the datevalue of a other table” Currently I have something like this, but it’s not working The 2nd select statement prints the date of the latest export. Example “27-JUL-21”. thanks for you…
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…