Is there a way to force netezza to generate full statistics on a table using SQL. I know it is possible to do via command line but that require nzsql client to be installed on the machine that initiates this command. According to the details mentioned here – https://www.ibm.com/support/pages/understandi…
Tag: sql
Dynamic SQL to Unpivot Data using Cross Apply with Multiple Columns
Microsoft SQL Server Management Studio v18.8 I have a table that will have varying columns and column names. I need to unpivot the data so I can then eventually store it into a different table. Unfortunately, this is the process since the original table is being pulled from a Google Sheet. I looked up several…
How do I create a dict of values from the results of an SQL query?
I’m trying to create a journey booking system in python/flask and am trying to create a dict of starting destinations and their ending destinations to allow me to run some ajax code which restricts the options of selecting destination based on the starting location like this (this is just an example of …
Add the last appearance to table
I have two tables (for example) table1 will contain stores, there are 2 types ‘candy store’ and ‘dental store’. Each row contains information about a customer’s purchase in a particular store table1 ( purchases ): table2 ( type ): I want my query to return a table like this: wher…
Calculate cumulative product value
I have the following database table: Date Return Index 01-01-2020 0.1 Null 01-02-2020 0.2 Null 01-03-2020 0.3 Null I would like to update the Index value using the following …
Apply multiple count conditionally in SQL Server query
I have a task table which contains some DateTime type columns like completed, pending, exception. It joins user table and I want to bring userName, AllTaskCount, AllPendingTaskCount, …
Calculate cumulative value in update query using SQL
I have the following database table: Date Return Index 01-01-2020 0.1 Null 01-02-2020 0.2 Null 01-03-2020 0.3 Null I would like to update the Index value using the following …
SQL paramaterisation in C#, using SQL declared variables
I have the following SQL query which I am sending from a C# program: DECLARE @id as int SELECT @id = max(fault_catagory_ident) FROM fault_catagory_list INSERT INTO fault_catagory_list (…
Attach the most recent timestamp when value was changed to each row
I have a dataset of updated properties: user_id flag updated_at 123 1 101 123 0 101 123 1 102 123 1 103 123 1 104 124 0 101 124 0 102 124 0 110 I need to assign to each row a value when was …
SQL – How to extract the rows that meet certain conditions
I will describe my problem and also show you what I tried to do in order to solve it. so first I have 3 tables like that: I want to get the status and the orderNumber from the orders table for all …