I have a large table that gets anywhere from 1-3 new entries per minute. I need to be able to find records at specific times which I can do by using a SELECT statement but it’s incredibly slow. Lets say the table looks like this: I’m trying to get data like this: I also need to get data like this:
Tag: where-clause
Execute different WHERE statement based on IF conditions depending on @variable?
I have a nativeQuery in my DAO layer inside my Spring Boot app. Basically, I’ passing three parameters, like so: I would like to have different WHERE statements executing depending on value of companyName, something like this: Or Answer Use boolean logic:
Get the logs of the current week in postgresql
I need to get the logs of the current week in postgresql, I have tried to use the native mysql functions yearweek for that, but here in postgresql it is different This is my table CREATE TABLE …
find exact number in text field in sql
I am trying to query exact number in array inside text field in sql so for example can return which is not good because i would like to get the arrays that contain 1 Answer You could use JSON functions:
i need a query to update column transferred_to to ‘Invalid_destination’ in Storage table if transferred_to column is equal 100
the query that i tried is this But i got this output so this is my table Answer You seem to want: Note that storage is a language keyword in MySQL, hence a poor choice for a column name. It would be simpler to use another column name, otherwise you need to quote it.
How to filter rows that has multiple condition MySQL
I have a table that contains my product details Now I want to write a query that gives me product_id(s) with this conditions: Brand = Intel model = Core i7 I’ve tried this one but it didn’t returns any rows, I guess I should use JOIN. Answer Use group by and having: Or better yet, using tuple equality:
How to pull data for past x weeks dynamically in redshift?
I have a below query which I run gives me the single count for previous week which is Week 43. Current week is 44 as of now. As of now the output I see is this which is for Week 43- Now I am trying to make this query dynamic such that it can give me count for past 6
How to SUM two SUMmed SQL result fields
I have a simple table structure holding records of reagent_bottles and reagent_aliquots. Aliquots are created from bottles, and an aliquot record got a foreign key, bottle_id, to a bottles id. To get the total volume of a particular reagent (counting both the volume in the bottles and the volume in the aliquots), the following query does the job, partly: returns
Check if an element is contained in the values (array) of a json column in MySql
I have the following values inside a cell of a json column in MySql: I would like to make a query that extracts data based on the existence of a value in the array at the fornitori key. For now I’ve tried this: Which print is: Basically the condition is that value (“8”) must be inside the fornitori list, otherwise
How to insert yes or no value into flag column based on regex query
I have a simple update that works great work analyzing a US based telephone number. It correctly inserts a Y in the phone_flag column based on the following query. UPDATE database.table SET phone_flag …