Category "sql"

simplify sql query Oracle database

Task: Write a query that returns a list of houses from the TB_ELEKTROSTAL_2018 table. It is considered that all subscribers who have the same address belong to

Querying pivot table to return a list of referred rows

I have these 6 tables and query which returns everything I want, but I want to add a new pivot table, so I can get a list of rows linked to it. Query: SELECT DI

Postgres array_position(array, element) sometimes 0-indexed?

Postgres method array_position(array, element), like other things in SQL, is 1-based. For example: SELECT array_position(array[4,5,6], 5) -- returns 2 But,

Extracting date and time from oracle

I have a table in which there is a field last_update_date in which the date is displayed in short form like 25/02/2015.If I want to extract the date in long dat

PostgreSQL- Function to update 3 shared columns from table B on table A

The main goal is to create a function that updates 3 columns on another table (the update of the 2 columns from the first table trigger the update on the second

SQL Runner (Google Looker) change date format in query

This topic has been covered several times but I can't find a solution that applies to SQL Runner, which is the custom query portion of Google's Looker platform.

Hi All, facing an issue of spark sql query for delete on basis of timestamp

I am running the delete query with the < (less then) and > (greater then) condition on the timestamp field but we are not getting the desired results. Fir

Unicode string cannot be passed to SQL query in form of parameter with pymssql

I'm having trouble passing a Unicode string to an SQL query via parameter. Initiate the connection and execute the query: conn = pymssql.connect(server='serverN

Need help joining 2 tables on one [duplicate]

So I got an admin dashboard which are not linked by ID but by name. So developer.name is the core name, dateName and absentName are meant to j

Errors unique to Db2 SQL queries

I am using Hacker Rank to learn SQL sufficiently to pass coding interviews. I have noticed an error in the online compiler when I run it using DB2. In Oracle,

Search by date MODX REVO

How do I filter records by date? I have the value 1639082700 which is equal to 2021-12-09 23:45:00. I need to find all data for 2021-12-09 which is equal to 163

How to connect to Power BI database outside of Power BI?

I'd like to connect to a power BI database and query it using SQL. My first instinct was to use Python's pyodbc package, like so: conn = pyodbc.connect( 'DRIVER

PopSQL is stuck at the startup and keeps loading, what should I do?

keeps loading what should I do?

How to convert a hash string to an integer in Snowflake?

I'm trying to get a hash of a decimal value and convert it to an integer. But the query results in the following error: Numeric value 'b902cc4550838229a710bfec4

One column group by order value

The table name is "OrderDetails" and columns are given below: | OrderDetailID | Order Value | | --- | -- | | 1 | 1000 | | 2 | 1200 | | 3 | 1500 | | 4 | 2000 | |

MySQL Select query between dates

I have a MySql table called contracts. I try to filter contracts applicable between two dates 2022-05-03 and 2022-05-07. MySQL query must be return id numbers:

How to select all columns except 2 of them from a large table on pyspark sql?

In joining two tables, I would like to select all columns except 2 of them from a large table with many columns on pyspark sql on databricks. My pyspark sql: %

How do I solve multiple joins producing duplicate application_id in sql query result

I have this query below and when I include the last join, I keep getting duplicate applicationid is the query result select distinct a.id, a.applicatio

BigQuery - unsupported subquery with table in join predicate

Recently I started to work on BigQuery and there's something that makes me still confused. What's the alternative for this query on Big Query? select a.abc, c.x

psql: how to exit with error if query returns 'False'?

I'm using psql to check if a table exists in a given database. The command below works fine to return t for True or f for False: psql -U $user -d $db -t -c "SEL