I have a predefined list of keywords , which I want to attach to a text during pattern matching. For e.g : Suppose the list of my keywords is : [‘DZ’ , ‘BL’ , ‘TS’ , ‘FZ’] The characters that I will …
Convert a set of columns into rows in ORACLE SQL
I have a query that returns a table that looks somewhat like below. In the image, I want the Input table to look like the Output table — Essentially, I want all the data from columns to get …
SQL connection string is not recognised and throws and exception in C#
CONTEXT: I am writing a WPF app. It works with a SQL Server database in which I put some data, concretely the strings Titulo and Descripcion, the int XP and the string fotoMision. When I click a …
count rows with group by and having count (postgres)
Hi I’m having trouble with query in PostgreSQL . Here is example data from my table imgs_tags : img_id | tag_id 1 2 1 3 2 2 2 3 3 2 3 3 I …
Hide null values on parameter value
I have a stored parameter with a where clause between start and end dates that includes null values: WHERE a.date is null OR a.date between @StartDate AND @EndDate These null values are obviously …
Oracle SQL: LAG over a range of values
How do we use analytic function LAG over the range of values. It should return null if there is no record in the partition with an earlier in_date otherwise, year and month of the previous in_date …
Add Sequential Letter column to table
In C I can switch between int and char to build a list of sequential integers and then convert them to ASCII characters that will be sequential according to the alphabet. Is there a way to do this in …
Query to modify where clause to specify relation
I have 2 tables: users & user_roles users: id name 1 John 2 Doe user_roles: user_id role 1 admin 1 finance 1 accounting 2 admin 2 finance 2 admin I want to get the users that have admin & finance roles in the output(with distinct). So the result will be only user with ID of 2 (Doe) What is the
postgres – aggregate items in text array
I have an array of text items, each text item in the array is a delimited string, here is a sample: drop table if exists tmp; create table tmp(x text); insert into tmp select (‘1~41.5~50~1|2~43.72~…
Find sum() from two different tables and join them based on a condition?
I have two tables, Table1: ID Amount Date —————— 123 500.00 02-Sep-2020 123 240.00 02-Sep-2020 124 200.50 02-Sep-2020 125 150.70 03-Sep-2020 123 480.80 03-Sep-2020 Table2 ID …