Category "sql"

Create/Query different tables based on conditional statement in BQ SQL

To illustrate with an example, say I have two tables in BigQuery called "fruits" and "vegetables" respectively. I want to have a variable at the start that lets

Regular expression not working Sybase ASE 16.0

I am trying to retrieve IDs from a table in Sybase ASE 16.0 The query has to return IDs starting with AB or BC. Example AB0001 AB0002 BC0001 BC0002 The regular

PK on temp table failing

I have a trigger which declares a table variable. DECLARE @TREarn_aaa table ( aaaID bigint NOT NULL PRIMARY KEY, Bbb decimal (18, 8) NULL, Ccc dec

Is there any way to filter by the first child using SqlAlchemy?

I'm trying to find a way to filter by the attribute of the first row returned as children. class Parent(Base): __tablename__ = "parent_table" id = Colum

SQL query question, how to make a query that outputs all entries of two tables

I have two tables, CITIES and FLIGHTS: CITIES id name 1 New York 2 Paris 3 Tokyo 4 Amsterdam FLIGHTS id departure_id arrival_id 1 1 2 2 1 3 3 2 3 4 2 4 I ne

Finding duplicate values in multiple colums in a SQL table and count for chars

referring to this question: Finding duplicate values in multiple colums in a SQL table and count I have the following table structure: id name1 name2 name3 ...

Is there a faster way to find the order of a COLUMN?

My SQL Server table looks like this ID a_Toyota a_Mazda a_Nissan a_Kia a_Honda a_Subaru SoldCar CarOrder 1 8000 7000 6200

SQL question using PIVOT, no aggregation column

I would like to do a PIVOT on my table but I don't have aggregation column. SELECT CONVERT(date, DataHora) AS dia, CONVERT(VARCHAR(5), DataHora, 108) A

Inner join of an EXCEPT subquery on column names that do not appear in the output

I have a table of students and classes. I would like to find what classes were dropped from one semester to another (and a similar query for classes added). Stu

JSON with roots for every selected day

I am struggling with the problem with nesting root for every day (it's an element of my table). I'd like to get nested Key: value pair of day from table Day. He

Oracle SQL: dummy variable from 2 data sets

I have two data tables. They both have an employee id column and a sales quarter column, in addition to lots of other columns. The first, which ill call "Rost

Error while creating View in SQL Database

I am working on database where I am trying to create view to get all records from Art table but i am getting error. My SQL query for creating the view is as fol

I have 29638 row to enter in my table. I used one of the solutions from a previous question but got an error message that the identifier is to long

I have 29638 row to insert into sql. Im used a solution from a previous question INSERT [HCO2].[Visits].[Biglist]... I got a error Msg 103, Level 15, State 4, L

Window function based on transition of a column value

I have response query like below dest emp 893106 0 717205 1 888305 0 312301 1 645100 0 222001 0 761104 1 And I want to get window function to separate rows li

can dolphinscheduler run a sql script or a python script file?

Can I upload sql scripts or python scripts, and run them in a process? I can only write sql statements in SQL tool, but I have some .sql files that should be ex

HOW TO GET QUERY IN SQL USING PHP IN SQL TIGGERING

This is my code my $sql variable didn't give query plese help me for this I try this but I couldn't please help me with that <?php $connect = mysqli_con

spark sql Find the number of extensions for a record

I have a dataset as below col1 extension_col1 2345 2246 2246 2134 2134 2091 2091 Null 1234 1111 1111 Null I need to find the number of extensions available fo

Alter table add column if not exists in MySql

I need to make an alter table via migration on a node:14 server with umzug. The code is : IF NOT EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_

How to load data of string of date in csv to mysql database?

Here is a glimpse of my .csv file: Name,Start Date,End Date,Budget Class 1,1/1/2020,31/1/2020,"USD10,000.00" Class 2,1/2/2020,28/2/2020,"USD14,000.00" The date

Want SQL statement to return all columns

Write a SELECT statement that returns the LastName, FirstName, and AnnualSalary columns of each instructor that has a unique annual salary. In other words, don