Bank of Ireland has requested that you detect invalid transactions in December 2022.
An invalid transaction is one that occurs outside of the bank's normal business hours.
The following are the hours of operation for all branches:
Monday - Friday 09:00 - 16:00
Saturday & Sunday Closed
Irish Public Holidays 25th and 26th December
Determine the transaction ids of all invalid transactions.
Man, I'm not sure I want to be banking with the Bank of Ireland if they are picking up bad transactions three years after the fact :-)
This sortta does sound like a homework assignment :-)
So first - lets get transactions in december
select *
from trans_table
where trans_date >= date '2022-12-01'
and trans_date < date '2023-01-01'
Now we want to see if they are meet any of the conditions above we can use variations of to_char
to_char(trans_date,'DY') gives day of week
to_char(trans_date,'DD') gives day of month
to_char(trans_date,'HH24') gives hour of day