You can achieve this by first determining the earliest date for each id in the info table, and then comparing this to the calendar table to find any dates that do not have a corresponding id. Here's an example SQL query that should accomplish this:
SELECT i.date, i.id
FROM info i
LEFT JOIN (
SELECT id, MIN(date) as first_date
FROM info
GROUP BY id
) f ON i.id = f.id
WHERE i.date > f.first_date
AND f.first_date IS NOT NULL
AND i.date NOT IN (
SELECT calendarDate
FROM calendar
);
This query first uses a subquery to determine the earliest date for each id in the info table. It then performs a left join with the info table to find any dates that occur after the first date for each id. Finally, it uses the NOT IN clause to exclude any dates that exist in the calendar table.
This query will return all pairs of (date, id) that do not exist in the info table after the first date that id appears.
It's worth noting that the query I provided will only return the pairs of (date, id) that are missing, but if you want to know which specific dates are missing for each id, you could use the following query:
SELECT id, GROUP_CONCAT(calendarDate) as missing_dates
FROM (
SELECT id, calendarDate
FROM info i
RIGHT JOIN calendar c ON i.date = c.calendarDate
WHERE i.id IS NULL
) x
GROUP BY id;
This query uses a subquery to join the info and calendar tables, and then selects the id and calendarDate columns from the result. The RIGHT JOIN clause is used to select only the rows from the calendar table that do not have a corresponding id in the info table. The outer query then uses the GROUP_CONCAT function to concatenate all of the missing dates for each id into a single string.
This query will return a table with two columns: id and missing_dates, where missing_dates contains a comma-separated list of all the dates in the calendar table that are missing for a given id.