I am trying to calculate the time difference between two columns of a row which are of string data type. If the time difference between them is less than 2 hours then select the first column of that row else if the time difference is greater than 2 hours then select the second column of that row. It can be
Tag: sql
How to populate dictionary using SQL table data
In my C# project, I have a dictionary, its values are currently static. Now I need to set to its values in dynamically. how can I do that? I have an Oracle DB table called “country” there have two columns called, ID and CountryName as follows, How can I set this table values to my dictionary? Than…
Do a dry-run of an Alembic upgrade
Sometimes alembic upgrade head may fail at runtime against my production database even though it worked fine against my testing databases. For instance, a migration might add a NOT NULL constraint to a column that didn’t previously contain NULLs in my testing environment, but did contain NULLs in produc…
Extract string between double quotes in SQL
I have a string and I need to return the characters between the double quotes ‘((“Name 1” and “Name 2”) or “Name 3”) I need to return I have used the function below to split the string but I am getting the (( and the Or and AND etc .. which I don’t want and unfo…
Golang db query using slice IN clause
Can someone explain to me why this does not work? And this does I’m trying to do a simple IN clause with a slice of ints, and every solution suggested doesn’t seem very idiomatic Tried to do this, but the problem appears to be the string substitution. I’m a bit surprised that go doesn’…
How do I see the source tables that Infor XA Power-Link is using to create the current view?
Through Infor XA Power-Link, I have access to a sales history view with things like quantity, price, item number, etc. Using System i Navigator, I would like to be able to run a SQL script that produces a similar table, but customized to my liking. However, I’m having trouble locating the tables involve…
Can somebody give a practical example of a many to many relationship?
I learned about many-to-many relationships in College, and I never really understood them. So far I’ve been working with one-to-many relationships which are easy to understand and deal with. Can somebody please give a practical example of a many-to-many relationship, and explain why we need a bridging t…
Insert into two tables and affect the id of one of the table columns into the other table
I have a Folder table which contain the following columns: And I have another one called Images which contains: I want to insert an url in the folder table in a query and put it in the images and get the id in the same query. Actually, I am working on an Android project, I have to add a new
Comparing two empty Strings in Oracle SQL
Hi today I have met with weird situation. I had a where clause where was condition which returns String and I wanted to check if it’s empty or not. And when it returns empty string Oracle still treat …
Group timestamp by hour SQLite
I am trying to group my timestamp column which has a data type of TimeStamp by hour. So this works for grouping by day: I have tried the following for grouping by hour: But this gives me the error: no such function: HOUR: I have seen similar questions asked, but it was DateTime used, not TimeStamp. Additional…