Skip to content

Tag: sql

How to print the required output with the help of SQL

I have tables ‘users’ and ‘user_transactions’ in AWS Athena. The table has many columns but I am interested in 2 columns viz. user name and txn_type. The txn_type column has 3 possible values viz. FT, NFT, PT. For each user, I need to print the count of each transactions in the below f…

Found the symbol “CREATE” instead of

I don’t know why it gives me this error: Error(3,3): PLS-00103: Found the symbol “CREATE” instead of one of the following: ( begin case declare exit for goto if … I tried using the backslash, but it doesn’t solve the problem, any help? Answer You cannot use DDL statements in PL/S…

SQL get every hour and minute of day

I would like to create a table with 2 columns – Hour and Minute. Table will store every combination of hour and minute in the day Example: A header Another header 0 1 0 2 0 3 … … 0 59 1 0 1 1 1 2 … … 23 59 I would like to populate the table using Oracle

how to extract and zip values from json with SQL, mysql

I struggle to extract the required values from the JSON column in MySQL. Imagine the variable: and I need to extract and return a new JSON array containing only selected key-value pairs, eg.: only a’s and b’s and if the required key does not exist I want to return null for that key: thanks Answer …