Skip to content
Advertisement

Tag: sql

Oracle Analytical Function?

For the given table below, how can we find the customer whose name appears 3 times consecutively. Desired_Output Table Definition: Code Tried so far I believe we can do this by using lead/lag to get the previous and next row. Although my solution gives the desired output but i don’t think this is correct solution. Answer Your method is close.

Join and flatten table output

I am currently trying to join 3 tables. The main table is company, if there is 3 companies and 2 roles exists in the role table I want the output to be like this: Company1, Role 1, …

Retrieve all records with the 5 most recent distinct dates

I need to retrieve data for a history module with pagination. The requirement is to show the records for the five most recent dates first (regardless of the number of rows) and load the remaining records in lots (next five dates, any number of rows) as requested by the user. I came up with the query below, which is extremely

Advertisement