I have a program that is to take a couple inputs and do stuff to them then store them in a local database (using SQL Server). I have the following code for the connection: SqlConnection con = new …
Tag: sql
Selecting string after the last \ using regex with Impala SQL
I have a dataset with a column with processes and the path. I am trying to use regex with Impala to strip off the executable. The dataset looks like this: C:\Windows\System32\svchost.exe C:\…
CASE clause in WHERE
I’m doing a leetcode question. 2 similar answers are worked out. But I have no idea why one is wrong and the other is right. The following is the question link. The goal is writing a SQL query to find all numbers that appear at least three times consecutively. https://leetcode.com/problems/consecutive-n…
Postgres Type of Parameter does not match
I am having an odd problem with Postgres (10.5). I have a function, generate_unique_name which takes in three text values. It works fine; however, calling this function seems to be an issue. When I …
Mysql unknown column in subquery works
There are three tables – mapping_hospital_procedure, master_hospital and master_procedure. master_hospital contains an id column to identify each hospital. master_procedure also contains an id …
How to find the distance traveled by user in a particular year?
UserId, SRC, DST, Mode, Dist, Year 1,CHN,IND,airplane,200,1990 2,IND,CHN,airplane,200,1991 3,IND,CHN,airplane,200,1992 4,RUS,IND,airplane,200,1990 5,CHN,RUS,airplane,200,1992 6,AUS,PAK,airplane,200,…
UPDATE statement using the same table in subquery
SELECT vl1.phone_number, vl1.first_name, CONCAT( SUBSTRING( ( SELECT vl2.phone_number FROM list as vl2 …
Keep ORDER BY clause is invalid in view
I have the following SQL Statement: Select CountryCodeTwoChar FROM (Select CountryCodeTwoChar From [Country] Order By CountryName ) TBL Where CountryCodeTwoChar = N’PS’ But I have the following …
How to convert 2011 -Q4 to 12-31-2011 in oracle sql?
How to convert 2011 -Q4 to 12-31-2011 in Oracle sql?
return the rows by family with sql
This is my first question in stackoverflow so be nice to me 🙂 i have a table which has a column family, when i make a query (with a where statment) i want to show the results as a group of rows with …