I have column called name under a table in Databricks. I want to find a way to select only those rows from a table, which contains at-least one alphabet character in the name column. Example values in the column: Expected: I need to pick only those values which contains at least one alphabet in it. Or in othe…
Tag: sql
How to get Output parameter from a column in table for a stored procedure
I’ve stored procedure like this: We can execute the above stored procedure by: The written sp provides data based on pagination and we can retrieve 100 or any number of records by passing a number in @int_grid_size . The table output looks like following: The last column gives the total records count of…
Generate DDL script for MySQL in Oracle SQL Developer
I made a relational model in Oracle SQL Developer and I want to make tables in MySQL Workbench. I generated the DDL script in SQL Developer and copied it in MySQL Workbench. I found out that the copied queries are not in correct syntax. I tried different options in SQL Developer to generate script and none of…
How can i grant an execute statment
I want to grant TRIGGERS, FUNCTIONS and PROCEDURES to a role. I have the code to do it with procedure but with triggers and functions it not work. Answer User owns tables, functions and procedures. That user created a role and wanted to grant execute on various objects to the role. for triggers, it doesn̵…
Avoid duplicate values using join with multiple tables in Firebird
I have 3 tables Payments PaymntID Date Amount 1 Ago.2021 500 2 Sep.2021 1200 3 Oct.2021 600 CashPayments PaymntID Amount 1 500 2 400 3 200 CreditCardPayments PaymntID Amount CreditCard 2 450 Visa 2 350 MC 3 400 Visa I need to get the PaymentID, date, amount payed in cash and amount payed in creditcard, but wi…
Share price less than certain value for 6 consecutive business days or more in the past month
This is for MySQL 8.X database. My requirement is as follows: If a share price is less than a certain value for 6 consecutive business days or more in the past month then I need to inform the investor. There will not be any share price on holidays and weekends. So there will not be any data for these days.
Windowing functions cumulative aggregation
I am calculating cumulative by summing some columns. The code is working. But I want to include an extra variable for the first line only. Then it miscalculates. What I want to do in line 1: What I want to do except line 1: When I do this with case, the wrong result is obtained. SQL code: So for example
Insert into Nested records in Bigquery
Iam using Bigquery to insert nested records into the table but eventually landed into error scenario. Schema: Code: with the above code, I couldn’t able to load the values into table. Please help me by letting know how exactly we can pass values into nested records. Answer Try below instead
SQL difference between cell values (LAG function not working)
Unfortunately I can’t use the lag function due to using SQL Server 2008. I need to find machine based difference between two values at different times. I have a table like that: I need to find a difference (76340-75000 = 1340) between id 1 and 3. Tried these before: but it compares with t1.id with the w…
How can I get a query displayed monthly with a subquery
I have a query here with a subquery. This shows me the complete result for the year. How do I get it to be displayed to me on a monthly basis. I’ve tried a few things but always get an error message Here my query The result should look like this: Thank you Answer You can probably simplify this by