I recently switched to intellij but I’m finding it hard to connect to my localDB. The same code worked on eclipse fine. Also I have already added the sqljdbc42.jar as a module dependency. Error produced: Any help would be greatly appreciated. I’ve also tried the overloaded DriverManager.getConnect…
What does the following SQL query do?
The drawing logs at that the company I work for use are written in MS Access VBA. The original code was written 15+ years ago by someone else, and we’re now running into errors with the reporting functionality that we can’t find a solution for. The query I’m having an issue with is the follo…
Get fill rates in another table – SQL Server
I am trying to create a script to calculate the fill rates for each column in a table Data_table and insert it into a second table Metadata_table. The Data_table has 30 columns in it, and some columns have 100% data in them, and some have less than 100% (due to nulls). My code to calculate the fill rate looks…
Return sums even if no data exist in given day
I have a table with amounts only on some days, e.g.: How can I query the data and get: I tried like: But still it doesn’t return 0s for days without data, any ideas? Answer In Access, you can create a series of dates between the first and the last date, and then create an outer join to your summed
Nested queries in SQL
I am trying to combine 2 queries using a nested query. The first one is this: SELECT DISTINCT( de.MCH_CODE) AS Mach, md.MAT_CODE as ShortenCode, de.TIME as start_time FROM table1 AS de JOIN …
PostgreSQL: append elements to jsonb array only if element is unique
I created a PostgreSQL (v10.0) table with a jsonb-array column as follows: Then I want add new animals to the first row as follows: However, I want to append only those elements that are not yet in the array. In this case only [chicken, 2]. Answer probably simplest would be:
multiple alter table in execute immediate
I want to do something like this in PL/SQL, but it throws me an error. How should I do it? Answer Problem is that you can’t run DDL directly in PLSQL. You can run them in separate execute immediates:
How to convert a date format YYYY-MM-DD into integer YYYYMMDD in Presto/Hive?
How to CONVERT a date in format YYYY-MM-DD into integer YYYYMMDD in Presto/Hive? I am trying to convert the below list into YYYYMMDD integers WITH all_dates as (SELECT CAST(date_column AS …
SQL: Split time interval into intersects of one hour
I am new to SQL, where I am trying to split time intervals into multiple rows of one hour, together with an indicator of how many minutes the interval overlaps each hour. My data: What I would like: What would be the easiest/fastest way to do this? Answer Try something like this: demo Result for sample data
Split a column in SELECT
I’m trying to get all records where I have a column concatenated with a :. The data stored in table as like this: I want to get below results by removing :extra from column in query: I’m not sure what should I do with my above query. Answer For SQL Server, you would do: You can find the columns us…