I have a PostgreSQL table named testing with a column named creation_time as timestamp with time zone. The database timezone is UTC Now I want to get all rows whose time is greater than 00:00 of the current day as per the timezone “America/New_York”. I know how to get all rows after local midnight…
SQL extracting date substring using regexp_subtr
I’ve got a field named signal_notes containing strings like the follow (this would be a single value of signal_notes): Sometimes, the ^expiry_date^ line will have a date between the ^’s in the format ‘YYYY-MM-DD’. My new field expiry_date will ideally be in the format ‘YYYY-MM-DD…
Find Previous Month MTD (Month to Date) Calculation in BigQuery
Assuming I have initial table of date and each order value of the date: So I use this query for calculating current MTD (cumulative gross order in a month from day 1 of certain month to certain date in that month), the result will be something like this: The idea is to also have value of previous month MTD va…
SQL: Updating 2 different columns in table from CTE condition
Hi I have a temp table with 2 different columns that I am trying to update from a CTE that has a boolean column ‘uninstalled’. As in: I then want to update the table ‘temp_customers’ above from the CTE and their respective columns (where uninstalled = true shall update column ‘ap…
Query works but cant retrieve the data
I am new to Node.js (3 days total experience). I am using Node.js and the tedious package to query a database (azure SQL). I use the example as explained here: https://docs.microsoft.com/en-us/azure/…
Condition OFFSET on SPLIT in SQL
I am using SQL on Google Big Query. I have a column MyColumn which value is in this format : Text0;Text1;Text2;Text3;Text4;T12=12/T26=5/T13=1/T55=ABC I need to fetch the value of T13 (“1” …
add auto generate column with correlated subqueries in mysql
I want to add a column that auto generates value depending on other tables. There are 2 tables to work with. Table “finance” : Table “price” : And by executing this command I get this result I wanted to make the revenue_x_10 auto generated by doing something like this. But looks like I…
Insert a record into database and associate it to a record in another table without the id
This may be a duplicate question, but I do not know the terminology to use to search for the answer. I have an account table with the following fields: id email And a widget table with the following …
Alternative way to run a query with join
I have the below query: select m.name, m.surname,m.teacher, c.classroom,c.floor from table1 as m inner join table2 as c on (m.name=c.name or m.surname = c.surname); But it takes a lot of time to …
how to pass in array in procedure call in oracle
I have a procedure that takes in an array in postgres, this syntax works: SELECT * from myMethod(array[‘test’,’test’], array[”], 554, 73430, 322234, ‘shazam’); the array keyword is what I am …