Question
ORACLE SQL Problem 3 A banking client provides a monthly snapshot of banking data (tens of millions of accounts) The data is sent with one
ORACLE SQL Problem 3
A banking client provides a monthly snapshot of banking data (tens of millions of accounts)
The data is sent with one row per account each month. This is stored in table called ACCOUNTS
Fields on the record include
Column | Description | Format/Example |
*YRMTH | Fiscal year and month of snapshot | 6 digit numeric, 4 digit year appended to 2 digit month, example 201401, 201411 |
*AccountID | Unique identifier for an account. | Integer, Example 10090207032 |
Starting Balance | Starting balance of account on close of previous month | $25,790 |
Closing Balance | Closing balance of account on close of month | $29,320 |
Investment Class | ..... | ... |
..... | ...... | ..... |
Many more columns, the two starred (*) columns are the only ones you will need for the query. There are no columns to tell when an account is closed, or just opened, and no separate Account Master you must use this table alone for your resultant query.
The table has been in place starting 200301, so many accounts have dozens of rows, if they have been open for many years, and others just 1 or 2 rows, if new.
Write a query to give just a list of accountDs that meet the following criteria.
- Has a record for the specific month 201403
- Also has a record for the specific month 201502
- Is missing one or more month records between these two.
A good account that has been open from 201403 to 201502 inclusive would have of course rows for
201403
201404
201405
201406
201407
201408
201409
201410
201411
201412
201501
201502
It is fine to hardcode the start month (201403), end month (201502) and the actual count of the months between these (10 exclusive or 12 inclusive) as part of your query.
Again the account must meet all 3 criteria to be a problem account. If they only have a partial set of these records but dont have the start month or dont have the end month, it is not an issue, only when they have both the spe
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started