Category "sql"

How to group multiple columns into a single array or similar?

I would like my query to return a result structured like this, where tags is an array of arrays or similar: id | name | tags 1 a [[1, "name1", "color1"

How to drop all tables from a database with one SQL query?

I don't want to type all tables' name to drop all of them. Is it possible with one query?

SQL values from a table with multiple groups

I have a table that has multiple persons linked to multiple groups. I have a procedure that needs to bring everyone from group 75588 but if this person is in gr

Filter rows from table 1 with table 2 info

I have 2 tables. One table listing results of a run and a 2nd table with timestamps. table1 (not sure how to add another column to the table but table 1 has an

How do these database management systems practically behave during a network partition?

I am looking into deploying a database management system, replicated across regions (various data centers across a country). I am currently looking into the fol

Find all stored procedures that reference another stored procedure

I want to find the all the directly and indirectly references to DB objects list. I am using below queries but I found the issue. DECLARE @Search varchar(255)

Need help by populating a PrimeReact Tree

I'm trying to populate a PrimeReact Tree with data from sqlite3 database, but it doesnt work. Here is my SQL-Query: select 'prj:'||p.id as key,p.name as label,(

The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)"

I'm trying to run the following statement but am receiving the error messages just below. I have researched answers to no end and none have worked for me. I'm

Default row order in SELECT query - SQL Server 2008 vs SQL 2012

Our team recently upgraded our databases from SQL Server 2008 to SQL Server 2012. One breaking change we noticed was in the default order of rows returned by th

How to efficiently remove duplicate rows in Spark Dataframe, keeping row with highest timestamp

I have a large data set which I am reading from Postgres. It has an ID column, a timestamp column and several other columns which may have been updated. For eac

Query to display Employee and Manager

I have to write a SQL Server query to display the employee last name and his respective manager’s name, as given below. John works for Robert Jane works f

How to calculate difference between two dates in oracle 11g SQL

When I am trying to calculate the date difference by using datediff function it showing that invalid identifier. SELECT DATEDIFF(day,'2008-08-05','2008-06-05

Typeorm of sql query

This query works well on the database, however I'm not able to make it work by using typeorm createQueryBuilder. SELECT * FROM content INNER JOIN FreeTextTable

SQL Server after update trigger

I have a problem with this trigger. I would like it to update the requested information only to the row in question (the one I just updated) and not the entire

Extract data from JSON column

i want to extract a value from a json column. The schema is (- first level, -- second level): Column Name | Type | Mode event_params RECORD NULLABLE -key STRI

Bigquery keyword Remote is not supported

We are trying out the REMOTE functions within bigquery as per this guide. We created the CLOUD_RESOURCE using the following command : bq mk --connection --disp

SPARK SQL - case when then

I'm new to SPARK-SQL. Is there an equivalent to "CASE WHEN 'CONDITION' THEN 0 ELSE 1 END" in SPARK SQL ? select case when 1=1 then 1 else 0 end from table Tha

Qlikview - Insert a recno() for each change in a column

I have a table with Document Numbers and items. We have integrated our software to a third party accounting package. The import to the third party does not take

run a query using EXECUTE BLOCK to prepair a column for an unique-Index

I have a column in a table that I want to use for an unique-index. My script should make the data unique by concat the id of a record, if the data of current re

ARRAY_AGG() grouped by another column's values

Here's my table like below p_no type name value ------------------------ 1 A Tomy 1 1 A Nick 2 1 B Tomy 3 1 B Nick 4 1