Skip to content
Advertisement

How do I derive a value for a column based on another column’s value?

I have a projects table like the one below. There are two slightly different id columns idx and idy–one idx can have multiple idys (for versioning). The goal is to consolidate the usage such that for every idx, the result will have: a use_count col which is SUM(use_count) for same idx the latest usage_date the name corresponding to the latest

Unrecognized name: error in nested query using bigquery standard sql

I am running the query where the inner statement (in this case I use when..case) and it is expected to run the query from the outer statement’s result. But, the result from the outer statement is in string datatype , so I added “as INT64” to solve this. However, the query still throw error “Unrecognized name: (score at [12:33]” Code:

SQL filter elements of array

I have a table of employee similar to this: I want to get the department, name, and age of all employees, something similar to this: How can I achieve this using SQL query? Answer I assume you are using Hive/Spark and the datatype of the column is an array of maps. Using explode and collect_list and map functions. Note that

Subtract scanner value from sql table value

I’m trying to subtract a scanner input from a table value. Here’s a screenshot of my table: Here’s what my code looks like: The output of my code is: Here’s what I want my table to look like after subtracting 100 (my scanner input quantity): I’m unsure as to why subtracting my scanner variable (quantity) doesn’t work, and I would

Azure SQL Database Manipulation

Is it possible to create a table in an Azure sql database using Python? I am pulling a list of things from an API and then want to push them to a table in my Azure sql db but can not find a tutorial or guide on how to do so. Googling for it led me to tutorials on how

Advertisement