I intend to interpolate (linear interpolation) between values in a column and insert that into a new column using a SQL query. Based on my search online, I suspect LEAD analytic function could be useful. I am new to writing SQL queries. So, any insights on how it can be achieved will be quite helpful. The sam…
Aggregate data from multiple rows to one and then nest the data
I’m relatively new to scala and spark programming. I have a use case where I need to groupby data based on certain columns and have a count of a certain column (using pivot) and then finally I need …
How to remove rest of the rows with the same ID starting from the first duplicate?
I have the following structure for the table DataTable: every column is of the datatype int, RowID is an identity column and the primary key. LinkID is a foreign key and links to rows of an other …
SQL Insert with AUTO INCREMENT
I am trying to insert 50 values into a DB, the table has two column names, one is an ID column set to auto increment and the other is for a code. When I attempt to do the insert I get a error. This …
SQL Server create primary key constraint duplicate key error
I have been experiencing some strange behaviour with one of my SQL commands taken from one of our stored procedures. This command follows the below order of execution: 1) Drop table 2) Select …
How to create a query to get the multiple row data in comma separated format in one row in Oracle
I have a requirement where I have column ‘NOTECODE’ in database table POLICY which contains multiple Note Codes in comma separated format. Ex: CC,TD,HL POLICY : POLICYNO | NOTECODE ———-|—-…
Arithmetic addition to aggregate function
I’m new to sql and wanted to perform a simple task using aggregate function in sql. select (current_data + avg(current_data)) as “average + current data” from datasets However, arithmetic addition …
How To Extract Distinct ID’s Present In One Table But Not Another
I have two tables, one with the sales entries (multiple of the same salesman id number), and another that is a master file of sales people (only one salesman id per each salesman). How can I write a …
Date_Trunc not function working as expected
I am trying to use the Date_Trunc for MONTH function in a SQL statement but somehow it is not working for me. I am trying to pull entries which happen after April 1st, 2019. The raw date format from …
How to select result of 2 multi conditional columns
im trying to display a result based on 2 multi-conditional columns. I have 3 columns,One being a client, one of them is Product and one of them is Class. There are multiple products that each have …