When having queries like this, for the inner query, should I use DSL or the dslContext that I have? return dslContext .insertInto(TABLE_FOO) .select( dslContext // vs DSL here …
Category: Questions
Truncate a column that is the result of CONCAT function?
I’m trying to truncate a column that I have created in my query to display only 15 characters, however I don’t know how to. In a table (yes), in a query (no). How would I write my code to do this? …
Extract a desired character from an alphanumeric column using concise REGEX in Oracle SQL
I am going through a “clean-up” process of a character column that holds employee rankings that should have a single character: 0-5 or M or U but instead it has up to 3 characters that are either numeric, alpha or alphanumeric. I spent the better part of two days researching online (Regex, Stack overflow and Oracle resources) and testing and
SQLServerException: No column name was specified for column 1 of ‘bounds’
I am trying to run the following code. The idea is to obtains lower and upper bound of source table, based on a given ID column. However, what I am getting is: And I am not really sure what the issue could be. Answer I haven’t used Scala or Databricks – but I do use SQL Server so my answer
Select distinct values by key from JSONB column
Postgres v12.0 I have a table data {“a”: “1”, “b”: “1”} {“a”: “2”, “b”: “1”} And I’d like to retrieve a distinct list of keys and the set of values for each key key values a [ “1”, “2” ] b [ “1” ] Not sure how to formulate a query to achieve those results. Answer here is one way:
Outsystems Advanced SQL
I will start by introducing my business logic. I have an entity called Machines. To each Machine I will assign up to 50 Options. On this query I used PIVOT so I can retrieve only one line per machine, with all the options (Columns) with value 0 or 1. Note: My Output structure is ready for 50 Options. SQL Query
SQL INNER JOIN of sum distinct values
I have 3 tables called musics, singers and playlistInfos. I want to get Top 10 listened England musics.What kind of sql query help me? SELECT * FROM musics m INNER JOIN playlistInfo p ON p.musicID = m.id INNER JOIN singer a ON a.id = m.singerID GROUP BY p.musicID ORDER BY p.listened I try this one but I did not get
How do I size and sapce
this is what i needed and i appreciate it guys Answer For problems like these, try to associate the output with its indices (or in this case, current_row). Also, it seems like it’s better to start from 0 for this one. max_row is 5, current_row is from 0 to 4. There are max_row – current_row – 1 spaces on each
SQL query to count how many values appear N times in a column
I have a table like this, but with 1mi rows: And I want to know how many TEAMS were visited N times. For instance, if I want to know how many TEAMS were visited once, the result would be 1 (because only team 2 was). If i wanted three times, result would be 2 (because both team 1 and 4
SQL query to find gaps within a column of dates
I have a table with status and date for every day and I’m trying to find out when the statuses change and if there’s gaps within each status change / how many days were of a certain status. Expected output: Answer This is a type of gaps-and-islands problem. In this case, subtracting a sequential number from each day is probably