Category "sql"

DISTINCT with HASH MATCH (Flow Distinct) in SQL Server

Recently, while working in SQL Server, I got an interesting thing that removing DISTINCT keyword actually decreased my query performance and increased my search

SQL customer who never order product p1 and p2 together

I do have two table. I want to find customers who never order product p1 and p2 together(there are million rows in this table) customer_id 2,4,1,4,2,1,3,2,1

How to convert nvarchar to date from one column to another in SQL Server

I have a column called “Month Year Raw” that has multiple nvarchar type data like this: 202201 and I want to convert that to a column called “

MySQL, Concatenate two columns

There are two columns in a MySQL table: SUBJECT and YEAR. I want to generate an alphanumeric unique number which holds the concatenated data from SUBJECT and

How do I execute clob in execute immediate

I have a table with one row and clob as column (whose size is 5239). This column contains a table script extracted with the help of dbms_metadata.get_ddl. Along

Is it safe to store dates as a string in mysql?

I have to allow my users to make an update with 24 hours of delay from their previous update, so because date operations in this case are going to be on the bac

Need to know if SQL Oracle can output a certain hierarchical style

Needing to know if this is possible. I'm trying to get a hierarchical output looking like this: TITLE|CHART|FUND|ORGN|PROGRAM S |S |null|null| S |S

Insert multiple records at once from a table

I have this table which is loaded with data from the database and what the user has to do is select the one they want and fill in the data from both the select

How to find count of duplicate values as a percentage in SQL?

I have eight columns in a table(birth_Record) of a hospital record. The record is considered duplicate if the below three columns are the same DATE_AND_TIME

Teradata: IN clause in Pivot can't take data from Table

I wish to extract a few Calender Weeks from an yearly data. Once that's done, I want to pivot it, so that there is one row for each ID. We have a table DB.MY_CW

How to split a multi value sql column into three single result

So I have a SQL column that stores data like this. "[1338,0,8523]" I was wondering if I can then garb each one individually and because the value is minutes, i

Postgresql pg_dump for "invalid page in block" database does not work properly

We have setup database postgresql 11 on a system. There are about 8 tables. From few days, we are facing this problem ERROR: invalid page in block 9698 of rela

SQL rank counting occurences

In my table I have data from employee contracts like this: And I want to get job position in time periods, something like this login ValidFrom ValidTo JobPosi

Azure Databricks - Generate SQL Select Statement with Columns

I have tables in Azure Databricks that I am using SQL to interact with via a notebook. I need to select all columns from a table with 200 columns, I need to sel

showing 1 data from Sqlflite flutter

So i want to make a delete button, so the user could delete those data according to the data they choose to see. Each time the data on the sqflite were added th

mysql with date function query running slow

I found something weird while executing query today and i want to know how this happens. Below is my query: select sum(price) as total from table_a where test

Display SQL query data in grid vaadin

I would like to display the result of my SQL query in a grid vaadin I can get the data from my toto table But I can't display them in a grid How to do it? publi

SQL query - How to increase the salary of employees, without exceeding a certain salary limit

I am trying to get a query that will allow me to increase the salary of people who earn less than 2000, but I don't want the salary increase for these people to

Drupal9: Saving form as node in SQL (custom module example)

i develop a custom module with forms to save data in SQL-Datebase. I want to use for that the node-structure. Normal SQL-savings for example table works but not

Use a Python f-string to build an SQL query 'IN' clause

I'm trying to use an f-string in Python to build my SQL query. The query below seems fine: code = ('123', '234') print(f"select * from tbl where code in {code}