Category "sql"

Order of CAST() and COALESCE() matters in MariaDB

I have a strange problem: There is a price in a JSON column in a table and the following statements give different results while they should give the same thing

Can not safely replay call when trying to assign and use a variable in procedure

I am trying use the data from a column in one table as column aliases of another table. DECLARE var1 VARCHAR(20), var2 VARCHAR(20); BEGIN WITH TABLE1

How to map an entity with multiple levels of clearance/perks?

For example, say I have a clearance pass entity, with basic, intermediate and high level clearance. basic has clearances of x, intermediate has clearances of x

SQL - How to join tables with dates to get overall view of ALL dates

Using a bespoke ERP system with T & A built in. Table 1 has dates with holidays types i.e. bank holidays, user booked holidays - and a user id. Table 2 has

Inserting values from another table into a column where values are null

I have a table A with ID's only and another table B with two columns, ID and Product Number. The ID column in table B has nulls and Product Number has Product N

Return ids after upsert Slick

I have a query that upserts the data to the database via Slick. I'd like to return the ids of the entities that were inserted. How can I do this using Slick in

Empty output using trino dbapi in python

I am getting empty output in the below code but when I remove the part of and I get the desired output. Can anyone clarify if there is any error in syntax of be

Hive subquery with Lateral View

I am trying to run the below code. I'm trying filtering on the jira_label field. I'm getting the below error. I know this means I should add aliases and I have

Real-time pipeline for processing data, insert into PSQL

I have files that will be coming in daily that I would like to process as they come in and insert into existing sql tables (using postgres). What is the best wa

If not exist with Date SQL

i want to add the time, if there is free time as example im doing that with two textboxes where im entering the date Database 20.04.2020 - 20.05.2020 so there s

Do i have to put a foreign key relation to any column in a table with relation with another table? larvavel 8, Sql

I have multiple tables, and some do have columns which are related but I am not certain if I have to put the foreign key relations to all columns which are rela

I need first 2 occurrences of duplicate id in the output(image attached) using sql

want first 2 occurrence of duplicate ID'S in the output, desired output in image attached. Please help

LEFT JOIN to return only first row

I am making a join with two tables, tab_usuarios (users) and tab_enderecos (address). tab_usuarios structure: id_usuario nome usuario 1 Administrador admin 2 N

SQL Dynamic binding in a IN list [duplicate]

Curent situation Currently I have this PL-SQL script with almost fifty words "hard-coded": DECLARE categoryToSearch VARCHAR2(16); BEGIN catego

SQL Replace command with Regex

So I am trying to run this SQL command Select Replace('[1,2,3,47]','%[0-9]\,|\[|\]%',''); this regex should give the following result 47 however, the original

GCP Server crashing with "cloudsql.enable_instance_password_validation"

Over the past day I have been experiencing this error very frequently which results in the cloud instance needing to be reset in order to continue connections:

How to add Azure SQL server to Grid.js table data attribute

I've been struggling for a couple of days trying to link my Grid.js to Azure SQL database. My SQL database query function returns the data, but I can't link it

SQLite impute missing values by mean for every group

I have an SQLite table as shown below. students grades Nick 34 Nick 42 Nick 86 Nick Null John 38 John 12 John 74 John Null Colin 87 Colin 23 Colin 46 Colin 42

How to use more than 1 quotation using getRows method and .implode in sql Query, using PHP

I'm trying to get all records from db using getRows method, to achieve that I need to implode special characters. In previous function, to get $ids I used: fore

updating sql with php

I need to be able to update my sql table from open to close task. I already wrote code for this but it is not working properly. On the modal it shows 2 'continu