Skip to content

Tag: sql

Performance difference with Where condition in subquery/cte

Is there a performance difference for applying the where condition to a subquery data source compared to applying it at the joined statement? Is there a difference between these in performance? Let’s say I have two hive tables A and B which are both partitioned on the field date. Is that query’s p…

Finding banks with higher assets in previous quarter SQL?

For each bank I need to find all dates with higher asset compared to its previous dates (quarter). (For instance a bank (id: 123) has asset 10,000 in 3/31/02 and asset 20,000 in 6/30/02. Then bank id (123), asset value (20,000) and date (6/30/02) should be recorded.) Report the first 10 observation of output …

SQL query for descending order by sum of values

I have an Apex Oracle app to do. This is the app description: A touristic destination is defined by its name and description. Each touristic destination has a number of bookings, defined by start date, end date, description, price as in the following example: Touristic destination: Hotel Sunrise, Hawaii Start…

SUM over datedifference?

Lets say I have the following records with column datetime dtTime quantity 2020-12-10 19:21:52.293 1 2020-12-10 19:21:52.323 2 2020-12-10 19:21:53.293 1 2020-12-10 19:21:58.293 1 2020-12-10 19:…