Let’s say I have a customer table. I need to create a select statement which will retrieve every end date of the month and compare the values for the amounts respective to the day or two after. If the amount for the day or two is different from the end date of that month, display the recent changed amou…
SQL Select Statement – Automation Anywhere
I am trying to write an SQL select statement where i only extract two columns from a csv which has been connected as a CSV. The select statement query i am using is: Which extracts all data in the table as expected, I wish to only extract data in columns with headers: The below line of code throws a syntax
SQL calculation for the sin() makes division by zero in one PosgreSQL function and don’t do it in another
There is a SQL call consisted of two general parts. The first one works, while the second one is commented out So, the question is why the error occurs only if the second part is commented out. The part where the division occurs are all the same: vs they both should be zero, or none. But only the second one
Get rows with a condition
Each customer can have one or multiple accounts (account_id) How can I get max closed_date for the customers who closed all their accounts and the rest of the active customers?* *active customers are …
How can I pull out the second highest product usage from a SQL Server table?
We have a product usage table for software. It has 4 fields, [product name], [usage month], [users] and [Country]. We must report the data by Country and Product Name for licensing purposes. Our rule …
Return Data based on Column
I am modifying a current query which returns n amount of rows. I would need to return the same amount of rows but with one more column of data. I have two sql tables shown below. Products and Product Attribute Values. When i run this query i get a few 1000 rows back. But when i run this query I
How do i get a result from a query? (Java, SQL) [closed]
package sql; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Main { public static …
Having problem with Select using month/hour
The database is from a Hospital and the problem is when the month changes, like this: The patient gets to the UTI on the date 30/03/2020 6AM and left on 02/04/2020 11AM so theoretically they spend (18+…
Counting rows with a window function
Each customer can have one or multiple accounts (account_id). To find customer churn, all accounts attached to a customer must be closed, i.e. having closed_date e.g. here customer churn is 2. How can …
ORA-00984: column not allowed here while inserting data excluding the sequence trigger
First I created table using this query:- CREATE TABLE mca ( id number not null primary key, name varchar2(200) not null, password varchar2(200) not null, email varchar2(200) not null, …