I have the following dataset
CREATE TABLE my_table
(
the_debt_id varchar(6) NOT NULL,
the_debt_paid date NOT NULL,
the_debt_due date NOT NULL
)
INSERT INTO my_table
VALUES ('LMUS01', '2019-05-03', '2019-05-02'),
('LMUS01', '2019-06-03', '2019-06-02'),
('LMUS01', '2019-07-01', '2019-07-02'),
('LMUS02', '2019-05-03', '2019-05-07'),
('LMUS02', '2019-06-07', '2019-06-07')
And I want to query this dataset by filtering only the rows where the_debt_paid is in June 2019.
The expected result is:
the_debt_id the_debt_paid the_debt_due
LMUS01 2019-06-03 2019-06-02
LMUS02 2019-06-07 2019-06-07
I tried the following:
SELECT * FROM my_table
WHERE EXTRACT(month, the_debt_paid) = 6
But I don't know how apply with the year which is 2019. Any help will be greatly appreciated.