Category "sql"

Setting the values ​of a COUNT(*)

I'm using SAS and I'm stuck when I want to relay this in SQL : I have a column that counts the number of line repetitions : DUPLICATES | NUMBER | DATE ------

I connot able to filter the current user record using c# and MS Access DB

I connot able to filter the current user record. I want to display the data of current user only. But I did not understand how to handl query. here is the ss of

Convert columns to rows in Spark SQL

I have some data like this: ID Value1 Value2 Value40 101 3 520 2001 102 29 530 2020 I want to take this data and convert in to a KV style pair instead ID Val

How to fill a datagridView with my stored procedure on load

I have this stored procedure that selects the top 10 results from its inner join CREATE PROCEDURE SP_SELECT_DOCS_WHERE_JOBID_STATUS @JobID INT, @BatchID

Impala compare consecutive rows and insert identical row if there are no values

I have a table that gives me data every month and I need that range of time. I noticed that sometimes I don't have data for 3/4 month but I need to duplicate th

How to validate the date in a varchar column in SQL Server

I have a staging table which contains all varchar columns. I want to validate a date stored in the data column. Since my staging table contains all varchar colu

Impala compare consecutive rows and insert identical row if there are no values

I have a table that gives me data every month and I need that range of time. I noticed that sometimes I don't have data for 3/4 month but I need to duplicate th

Search Listview using Textbox in C# from SQL Database

I use followng code in VB.Net to search data in listview using TextBox. This code was VB.NET i have changed this to C# according to my understanding as i am new

SPARK SQL create table does not show / read all columns as expected

I am trying to create table in spark sql by providing the schema and giving the location. However when i run select on the table, i see only half the columns. (

How is a binary/bytes column sorted in sql?

The following query sorts a binary column in BigQuery: with tbl as ( select B'123' as col union all select B'234' ) select * from tbl order by col; ----------

How do I write a query to find highest earning day per quarter?

I need to write a sql code to pull the single, highest-earning day for a certain brand of each quarter of 2018. I have the following but it does not pull a sing

I'm trying to join 2 tables that don't have same columns and using case select. Is this possible?

select case when code = number_1 then number_1=code when count(code)>=count(number_1) then number_1 = sum(code)

PostgreSQL 12.2 with Sequelize 6.3 - UPSERT a array of data and want ON CONFLIT DO UPDATE to merge current existing JSONB and EXCLUDED JSONB

I'm currently using this query to insert or update my array of data when retrieving my list : try { const query = `INSERT INTO "Tables" ("id","tomerge

SQL Query Find sums from one column for two different columns

I have a Table with Debit Accounts, Credit Accounts and Amount of Transactions between them. I need to take every Account(Which might be debit sometimes and cre

Error: 'duplicate key value violates unique constraint' even when checking with 'where not in'

I get the error: 'duplicate key value violates unique constraint' even when checking if the primary key is already in the table in which I want to insert. I ha

Create a procedure to fill a new table

I am new to PostgreSQL and am struggling with the creation of a procedure to save the data in a new table. This is how the empty table is created CREATE TABLE e

How to reference the default schema in liquibase preCondition sqlCheck

Posting here in case it helps someone. TLDR: ${database.defaultSchemaName} within sqlCheck to access default schema name I wanted my database changeset to firs

Oracle db - remove ,, from email address

I'm running below code and getting below results but I want to remove ,, and after ,, texts from email address and that email address should show in UPPER(PT_PA

Remove duplicate entries from string array column of postgres

I have a PostgreSQL table where there is column which has array of strings. The row have some unique array strings or some have duplicate strings also. I want t

Reverse EBCDIC sorts numbers before letters in ROW_NUMBER function

So I do have following SQL select SELECT FOO.*, ROW_NUMBER() OVER (ORDER BY KEY ASC) AS ROW_NUMBER FROM FOO Key is of the type VARCHAR(12). I wonder why the h