I have a table similar to this small example: I want to manipulate it to this format: Here’s a sample SQL script to create an example input table: CREATE TABLE sample_table ( id INT, hr INT, …
“not like” in DolphinDB SQL
It returns the following error message: Does anyone know what I can do with it? Answer It doesnt support not like. Use not as follows:
How do i pivot this redshift table? (Revised question)
Note: This is a revised version of another question – i realized i didnt have complete requirements (sorry about that!) I have a Redshift table called metadata with the following columns: id key value 1001 code1 my value 1001 code2 another 1001 code3 yet another 1002 code1 new one 1002 code2 here 1002 code3 last 1003 code1 hello 1003 code2
Determine time duration based on events without using loops
I have a table with timestamps of 5 different types of events (start, stopped, restart, aborted, and completed). The given table looks like this: Time EventID Event 7:38:20 1 start 7:40:20 2 stopped 7:48:20 3 restart 7:50:20 4 aborted 8:00:20 1 start 8:40:20 5 completed 8:58:20 1 start 9:00:15 4 aborted I would like to determine the following and display
How best can I to pivot my redshift table?
I have a Redshift table called metadata with the following columns: id key value 1001 code1 my value 1001 code2 another 1001 code3 yet another 1002 code1 new one 1002 code2 here 1002 code3 last 1003 code1 hello 1003 code2 goodbye 1004 code2 now 1004 code3 then I’d like to have a query that return it as: id code1 code2
Test ARRAY whether it contains ALL or NO elements of given ARRAY
Suppose we have an array: With the operator <@ I can query whether the left-operand is a sub-array of the right-operand: The above works greatly but now let’s take the following case: In this case the above will return false as expected. Do we have an operator which says the following: either the left array is contained by the right
Syntax error when using input parameter to create procedure
I’m getting this error Msg 103010, Level 16, State 1, Line 1 Parse error at line: 33, column: 15: Incorrect syntax near ‘@sas_token’ For reference here are the guides I am following: https://learn.microsoft.com/en-us/azure/synapse-analytics/sql-data-warehouse/quickstart-bulk-load-copy-tsql-examples#b-shared-access-signatures-sas-with-crlf-as-the-row-terminator-windows-style-new-line https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/develop-stored-procedures#stored-procedures-in-synapse-sql I tried the commented part because I thought it didn’t recognize the quotes but it still didn’t work This procedure will be called from Python like
Oracle DB sql group the table_names patterns into a group
I am trying to classify certain patterns of tables in individual groups and display the results this is fine i included a case statements and classified it but how to group the counts , let provide the sql logic and existing results and expected results so that it will be understood. database is Oracle 11g SQL Query EXISTING RESULTS EXPECTED
Parse out word between two characters SQL Netezza
I am having trouble finding the correct syntax to parse out a word between two characters in Netezza. PATIENT_NAME SMITH,JOHN L BROWN,JANE R JONES,MARY LYNN I need the first name which is always after the comma and before the first space. How would I do this in Netezza? Answer I think Netezza supports regexp_extract(). That would be: Or regexp_replace():
Bigquery SQL MAX() text value
Thanks for taking the time to look at this. How to get the MAX of a text value in column A. I would like to and another where clause to show only one of the “FY20-Q4M#” (MAX value only) Current Table YY-QQ_STATUS Program FY20-Q2_ACTUALS XYZ FY20-Q3_ACTUALS XYZ FY20-Q3_BUDGET XYZ FY20-Q4M0 XYZ FY20-Q4M1 XYZ FY20-Q4M2 XYZ FY20-Q4_BUDGET XYZ FY20-Q4_OUTLOOK XYZ Goal: